I am a newbie Python programmer trying to make 3d barplots like
http://matplotlib.sourceforge.net/examples/mplot3d/bars3d_demo.html this
one on the Matplotlib site.
When I run the demo source (python bars3d_demo.py) it works fine. I then
changed the way xs and ys are assigned, to
xs = np.array([1.,2.,3.]) # was xs = np.arange(20)
ys = np.array([1.,2.,3.]) # was ys = np.random.rand(20)
ax.bar(xs, ys, zs=1, zdir='y', color='r', alpha=0.8)
(ditto for two other data sets)
Now the bars are triangles. The right side of each bar is of the correct
height, but the left side of each bar starts at zero.
Python version 2.6.5
Matplotlib version 1.0.1
Ubuntu 10.04
Thanks in advance!
Complete source of my (misbehaving) program:
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
xs = np.array([1.,2.,3.])
ys = np.array([1.,2.,3.])
ax.bar(xs, ys, zs=1, zdir='y', color='r', alpha=0.8)
ys = np.array([1.,4.,9.])
ax.bar(xs, ys, zs=2, zdir='y', color='r', alpha=0.8)
ys = np.array([2.,1.,2.])
ax.bar(xs, ys, zs=3, zdir='y', color='r', alpha=0.8)
ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')
plt.show()
···
–
View this message in context: http://old.nabble.com/ramp-shaped-bars--tp31236873p31236873.html
Sent from the matplotlib - users mailing list archive at Nabble.com.