## matplotlib-users

 [Matplotlib-users] ramp shaped bars? From: jford14685 - 2011-03-25 11:31:59 ```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. ```
 Re: [Matplotlib-users] ramp shaped bars? From: Angus McMorland - 2011-03-25 12:11:14 ```On 25 March 2011 07:31, jford14685 wrote: > 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. Here's another data point. My guess is this is a bug with Axes3D: I can recreate the problem with 3 bars, but with >4 bars everything works okay. On my setup, with exactly 4 bars, the leftmost edge of the bars doesn't get a border, so something possibly related is going on there too. Angus. -- AJC McMorland Post-doctoral research fellow Neurobiology, University of Pittsburgh ```
 Re: [Matplotlib-users] ramp shaped bars? From: Jim Ford - 2011-03-25 15:25:36 ```Well, what do you know? For once, the call of the noob, "Hey! there must be a bug" speaks truth. Thanks, Angus! I added a little code to duplicate the last point until the array length is at least 5, and everything looks just fine. On 03/25/2011 01:10 PM, Angus McMorland wrote: > On 25 March 2011 07:31, jford14685 wrote: >> 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. > Here's another data point. My guess is this is a bug with Axes3D: I > can recreate the problem with 3 bars, but with>4 bars everything > works okay. On my setup, with exactly 4 bars, the leftmost edge of the > bars doesn't get a border, so something possibly related is going on > there too. > > Angus. ```
 Re: [Matplotlib-users] ramp shaped bars? From: Michael Droettboom - 2011-03-28 15:09:02 ```Would you mind filing a bug for this in the issue tracker? https://github.com/matplotlib/matplotlib/issues Mike ________________________________________ From: Jim Ford [jford14685@...] Sent: Friday, March 25, 2011 11:25 AM To: matplotlib-users@... Subject: Re: [Matplotlib-users] ramp shaped bars? Well, what do you know? For once, the call of the noob, "Hey! there must be a bug" speaks truth. Thanks, Angus! I added a little code to duplicate the last point until the array length is at least 5, and everything looks just fine. On 03/25/2011 01:10 PM, Angus McMorland wrote: > On 25 March 2011 07:31, jford14685 wrote: >> 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. > Here's another data point. My guess is this is a bug with Axes3D: I > can recreate the problem with 3 bars, but with>4 bars everything > works okay. On my setup, with exactly 4 bars, the leftmost edge of the > bars doesn't get a border, so something possibly related is going on > there too. > > Angus. ------------------------------------------------------------------------------ Enable your software for Intel(R) Active Management Technology to meet the growing manageability and security demands of your customers. Businesses are taking advantage of Intel(R) vPro (TM) technology - will your software be a part of the solution? Download the Intel(R) Manageability Checker today! http://p.sf.net/sfu/intel-dev2devmar _______________________________________________ Matplotlib-users mailing list Matplotlib-users@... https://lists.sourceforge.net/lists/listinfo/matplotlib-users ```