I would like to add tick labels to a 3d plot, but so far have had no
luck.  I would like to start with something like the bars3d example:
http://matplotlib.sourceforge.net/examples/mplot3d/bars3d_demo.html

But I would like to have each bar chart labeled by its tick on the
y-axis.  The traditional ax.yaxis.set_ticklabels() method has no
effect, and the ax.yaxis.set_ticks() just messes up the output
catastrophically.

My attempt at modifying the example is below.  Any thoughts?

Thanks,
Jeff

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

fig = plt.figure()
ax = Axes3D(fig)
for c, z in zip(['r', 'g', 'b', 'y'], [30, 20, 10, 0]):
    xs = np.arange(20)
    ys = np.random.rand(20)
    ax.bar(xs, ys, zs=z, zdir='y', color=c, alpha=0.8)

## My changes
ax.yaxis.set_ticks([0, 10, 20, 30]) # This totally screws things up
ax.yaxis.set_ticklabels(['first', 'second', 'third', 'fourth']) # This
does absolutely nothing
## End my changes

ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')

plt.show()
------------------------

|| Jeff Klukas, Research Assistant, Physics
|| University of Wisconsin -- Madison
|| jeff.klu...@gmail | jeffyklu...@aim | jeffklu...@skype
|| http://www.hep.wisc.edu/~jklukas/

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to