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

fosa jayme.c.fosa at gmail.com
Thu Mar 1 08:30:12 EST 2018


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


More information about the Matplotlib-users mailing list