Matplotlib 3D: Remove axis ticks & draw upper edge border?

Hello,

I've been trying to no avail to use the settings that usually work with
matplotlib 2D. I'd like to remove the 3D graph ticks, and extend the
darkened color edge to the upper sides as well. As a bonus if someone knows
how to control the axis of rotation for a 3d animation, to effectively
control the centering, that would be a great help as well.

Here is a self contained code block that I've been hacking away at with a
dull knife:

import numpy as np
import matplotlib as mpl
from matplotlib import pyplot as plt
from matplotlib import animation
from mpl_toolkits.mplot3d import Axes3D

mpl.rcParams['ytick.color'] = 'white'
#mpl.rcParams['ytick.left'] = False

sample = np.random.random_integers(low=1,high=5, size=(10,3))

# Create a figure and a 3D Axes
fig = plt.figure(figsize=(5,5))

ax = Axes3D(fig)

#ax.w_xaxis.set_tick_params(color='white')

#ax.axes.tick_params
ax.axes.tick_params(bottom=False, color='blue')
##['size', 'width', 'color', 'tickdir', 'pad', 'labelsize',
##'labelcolor', 'zorder', 'gridOn', 'tick1On', 'tick2On',
##'label1On', 'label2On', 'length', 'direction', 'left', 'bottom',
##'right', 'top', 'labelleft', 'labelbottom',
##'labelright', 'labeltop', 'labelrotation']

colors = np.mean(sample[:, :], axis=1)

ax.scatter(sample[:,0], sample[:,1], sample[:,2],

           marker='o', s=20, c=colors, alpha=1)

ax.tick_params(color='red')
ax.spines['left'].set_color('green')

frame1 = plt.gca()
frame1.axes.xaxis.set_visible(False)
#frame1.axes.xaxis.axes.set_xticks([])
frame1.axes.xaxis.set_ticklabels([])
frame1.axes.yaxis.set_ticklabels([])
frame1.axes.zaxis.set_ticklabels([])
#frame1.axes.yaxis.set_tick_params(color='white')

And the image it generates:
<http://matplotlib.1069221.n5.nabble.com/file/t5138/3dSO.png>

Setting #frame1.axes.xaxis.axes.set_xticks([]) causes all the grid lines to
disappear, instead of just the ticks themselves.
Is it required to go into whatever is drawing/rendering and adjust the
length of the grid line? T_T

···

--
Sent from: http://matplotlib.1069221.n5.nabble.com/matplotlib-users-f3.html

Sorry, those features are just not possible with the current design. The
code assumes that all rotations are done from the center. And the tick
marks aren't handled the same way they are in 2D graphs, unfortunately.
Also, the code has just three backing panels. It is possible to make one or
more of them invisible, but you can't add more panels. In fact, you
wouldn't want other panels to appear because it is assumed that these
panels will always appear behind any other artists. Any other panels would
run the risk of being composed incorrectly with the contents of the plot,
creating "Escher effects" -- visual paradoxes. Nothing is stopping you,
though, from putting in your own panel from a Poly3D or Patch3D object. In
fact, you can just create a Patch artist and put it through the 2d to 3d
converter function in mplot3d.art3d.

I would consider the current state of tick control to be buggy, and I agree
that effort should be spent fixing it. Having the ability to specify an
arbitrary point of rotation is an interesting feature and I wouldn't be
opposed to a merge request adding that feature.

···

On Thu, Mar 1, 2018 at 8:30 AM, fosa <jayme.c.fosa at gmail.com> wrote:

Hello,

I've been trying to no avail to use the settings that usually work with
matplotlib 2D. I'd like to remove the 3D graph ticks, and extend the
darkened color edge to the upper sides as well. As a bonus if someone
knows
how to control the axis of rotation for a 3d animation, to effectively
control the centering, that would be a great help as well.

Here is a self contained code block that I've been hacking away at with a
dull knife:

import numpy as np
import matplotlib as mpl
from matplotlib import pyplot as plt
from matplotlib import animation
from mpl_toolkits.mplot3d import Axes3D

mpl.rcParams['ytick.color'] = 'white'
#mpl.rcParams['ytick.left'] = False

sample = np.random.random_integers(low=1,high=5, size=(10,3))

# Create a figure and a 3D Axes
fig = plt.figure(figsize=(5,5))

ax = Axes3D(fig)

#ax.w_xaxis.set_tick_params(color='white')

#ax.axes.tick_params
ax.axes.tick_params(bottom=False, color='blue')
##['size', 'width', 'color', 'tickdir', 'pad', 'labelsize',
##'labelcolor', 'zorder', 'gridOn', 'tick1On', 'tick2On',
##'label1On', 'label2On', 'length', 'direction', 'left', 'bottom',
##'right', 'top', 'labelleft', 'labelbottom',
##'labelright', 'labeltop', 'labelrotation']

colors = np.mean(sample[:, :], axis=1)

ax.scatter(sample[:,0], sample[:,1], sample[:,2],

           marker='o', s=20, c=colors, alpha=1)

ax.tick_params(color='red')
ax.spines['left'].set_color('green')

frame1 = plt.gca()
frame1.axes.xaxis.set_visible(False)
#frame1.axes.xaxis.axes.set_xticks()
frame1.axes.xaxis.set_ticklabels()
frame1.axes.yaxis.set_ticklabels()
frame1.axes.zaxis.set_ticklabels()
#frame1.axes.yaxis.set_tick_params(color='white')

And the image it generates:
<http://matplotlib.1069221.n5.nabble.com/file/t5138/3dSO.png&gt;

Setting #frame1.axes.xaxis.axes.set_xticks() causes all the grid lines
to
disappear, instead of just the ticks themselves.
Is it required to go into whatever is drawing/rendering and adjust the
length of the grid line? T_T

--
Sent from: http://matplotlib.1069221.n5.nabble.com/matplotlib-users-
f3.html
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
Matplotlib-users Info Page

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20180301/fa3ea9f9/attachment.html&gt;

What I did as a workaround this is to modify the plot limits:

···

#########################################################################
#
#########################################################################
def equalize_plotlimits_3d(ax):

   xl = ax.get_xlim()
   yl = ax.get_ylim()
   zl = ax.get_zlim()

   xr = xl[1] - xl[0]
   yr = yl[1] - yl[0]
   zr = zl[1] - zl[0]

   xave = (xl[1] + xl[0])/2
   yave = (yl[1] + yl[0])/2
   zave = (zl[1] + zl[0])/2

   maxr = max([xr,yr,zr])

   ax.set_xlim(xave-maxr/2, xave+maxr/2)
   ax.set_ylim(yave-maxr/2, yave+maxr/2)
   ax.set_zlim(zave-maxr/2, zave+maxr/2)

   xl = ax.get_xlim()
   yl = ax.get_ylim()
   zl = ax.get_zlim()

   return [xl,yl,zl]

#########################################################################
#
#########################################################################
def pan(axis, shift, ax=None, dodraw=True):

   if not ax: ax = gca()

   which = dict(x=0,y=1,z=2)
   setter = [ax.set_xlim, ax.set_ylim, ax.set_zlim]
   getter = [ax.get_xlim, ax.get_ylim, ax.get_zlim]

   lim = getter[which[axis]]()
   lim[0] += shift
   lim[1] += shift

   setter[which[axis]](lim)
   if dodraw:
     draw()

def xpan(*args, **kwargs):
   pan('x', *args, **kwargs)
def ypan(*args, **kwargs):
   pan('y', *args, **kwargs)
def zpan(*args, **kwargs):
   pan('z', *args, **kwargs)

#########################################################################
#
#########################################################################
def zoom(scale, ax=None, dodraw=True):

   if not ax: ax = gca()

   xl = ax.get_xlim()
   yl = ax.get_ylim()
   zl = ax.get_zlim()

   xr = xl[1] - xl[0]
   yr = yl[1] - yl[0]
   zr = zl[1] - zl[0]

   xave = (xl[1] + xl[0])/2
   yave = (yl[1] + yl[0])/2
   zave = (zl[1] + zl[0])/2

   maxr = max([xr,yr,zr])

   ax.set_xlim(xave-maxr/2/scale, xave+maxr/2/scale)
   ax.set_ylim(yave-maxr/2/scale, yave+maxr/2/scale)
   ax.set_zlim(zave-maxr/2/scale, zave+maxr/2/scale)

   xl = ax.get_xlim()
   yl = ax.get_ylim()
   zl = ax.get_zlim()

   if dodraw:
     draw()

On 3/1/18 11:44 AM, Benjamin Root wrote:

Sorry, those features are just not possible with the current design. The
code assumes that all rotations are done from the center. And the tick
marks aren't handled the same way they are in 2D graphs, unfortunately.
Also, the code has just three backing panels. It is possible to make one
or more of them invisible, but you can't add more panels. In fact, you
wouldn't want other panels to appear because it is assumed that these
panels will always appear behind any other artists. Any other panels
would run the risk of being composed incorrectly with the contents of
the plot, creating "Escher effects" -- visual paradoxes. Nothing is
stopping you, though, from putting in your own panel from a Poly3D or
Patch3D object. In fact, you can just create a Patch artist and put it
through the 2d to 3d converter function in mplot3d.art3d.

I would consider the current state of tick control to be buggy, and I
agree that effort should be spent fixing it. Having the ability to
specify an arbitrary point of rotation is an interesting feature and I
wouldn't be opposed to a merge request adding that feature.

On Thu, Mar 1, 2018 at 8:30 AM, fosa <jayme.c.fosa at gmail.com > <mailto:jayme.c.fosa at gmail.com>> wrote:

    Hello,

    I've been trying to no avail to use the settings that usually work with
    matplotlib 2D.? I'd like to remove the 3D graph ticks, and extend the
    darkened color edge to the upper sides as well.? As a bonus if
    someone knows
    how to control the axis of rotation for a 3d animation, to effectively
    control the centering, that would be a great help as well.

    Here is a self contained code block that I've been hacking away at
    with a
    dull knife:

    import numpy as np
    import matplotlib as mpl
    from matplotlib import pyplot as plt
    from matplotlib import animation
    from mpl_toolkits.mplot3d import Axes3D

    mpl.rcParams['ytick.color'] = 'white'
    #mpl.rcParams['ytick.left'] = False

    sample = np.random.random_integers(low=1,high=5, size=(10,3))

    # Create a figure and a 3D Axes
    fig = plt.figure(figsize=(5,5))

    ax = Axes3D(fig)

    #ax.w_xaxis.set_tick_params(color='white')

    #ax.axes.tick_params
    ax.axes.tick_params(bottom=False, color='blue')
    ##['size', 'width', 'color', 'tickdir', 'pad', 'labelsize',
    ##'labelcolor', 'zorder', 'gridOn', 'tick1On', 'tick2On',
    ##'label1On', 'label2On', 'length', 'direction', 'left', 'bottom',
    ##'right', 'top', 'labelleft', 'labelbottom',
    ##'labelright', 'labeltop', 'labelrotation']

    colors = np.mean(sample[:, :], axis=1)

    ax.scatter(sample[:,0], sample[:,1], sample[:,2],

     ? ? ? ? ? ?marker='o', s=20, c=colors, alpha=1)

    ax.tick_params(color='red')
    ax.spines['left'].set_color('green')

    frame1 = plt.gca()
    frame1.axes.xaxis.set_visible(False)
    #frame1.axes.xaxis.axes.set_xticks()
    frame1.axes.xaxis.set_ticklabels()
    frame1.axes.yaxis.set_ticklabels()
    frame1.axes.zaxis.set_ticklabels()
    #frame1.axes.yaxis.set_tick_params(color='white')

    And the image it generates:
    <http://matplotlib.1069221.n5.nabble.com/file/t5138/3dSO.png
    <http://matplotlib.1069221.n5.nabble.com/file/t5138/3dSO.png&gt;&gt;

    Setting #frame1.axes.xaxis.axes.set_xticks() causes all the grid
    lines to
    disappear, instead of just the ticks themselves.
    Is it required to go into whatever is drawing/rendering and adjust the
    length of the grid line? T_T

    --
    Sent from:
    http://matplotlib.1069221.n5.nabble.com/matplotlib-users-f3.html
    <http://matplotlib.1069221.n5.nabble.com/matplotlib-users-f3.html&gt;
    _______________________________________________
    Matplotlib-users mailing list
    Matplotlib-users at python.org <mailto:Matplotlib-users at python.org>
    Matplotlib-users Info Page
    <https://mail.python.org/mailman/listinfo/matplotlib-users&gt;

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
Matplotlib-users Info Page

Hi Mike thanks for replying. I can't quite get your methods to work. Would
you mind posting a barebones example of a 3d plot with the ticks disabled?

···

--
Sent from: http://matplotlib.1069221.n5.nabble.com/matplotlib-users-f3.html

hi
i have a draw in black and white as a mosaic
i can get the coordinates of one point in each field af the mosaic
what i miss would be an option to "fill"
does such an option exist in Matplotlib ?

        ???
                  Vincent Douce
               :=: Mathoscope :=:
             http://mathoscope.xyz
                 06?13?11?07?26
          Bagn?res de Bigorre 65200

Do you have an example image for reference? Can you share the code you've
already written.

Matplotlib can draw full or hollow polygons that represent an area and use
full or hollow markers that represent a point.

There is also the concept of a "span" that is boundless in one dimension,
and constrained in the other:
https://matplotlib.org/gallery/api/span_regions.html#sphx-glr-gallery-api-span-regions-py

-paul

···

On Thu, Mar 8, 2018 at 8:29 AM, Vincent Douce Mathoscope < mathoscope at netcourrier.com> wrote:

hi
i have a draw in black and white as a mosaic
i can get the coordinates of one point in each field af the mosaic
what i miss would be an option to "fill"
does such an option exist in Matplotlib ?

        ???
                  Vincent Douce
               :=: Mathoscope :=:
             http://mathoscope.xyz
                 06?13?11?07?26
          Bagn?res de Bigorre 65200

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users at python.org
Matplotlib-users Info Page

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20180308/e7104e6b/attachment.html&gt;