[Matplotlib-users] Matplotlib 3D: Remove axis ticks & draw upper edge border?

Benjamin Root ben.v.root at gmail.com
Thu Mar 1 11:44:43 EST 2018


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>
>
> 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
> https://mail.python.org/mailman/listinfo/matplotlib-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20180301/fa3ea9f9/attachment.html>


More information about the Matplotlib-users mailing list