Hi Derek,

I just tried your program with the latest svn version and that seems
to work fine, so I'd suggest you try that as well [1]. It looks to me
like the fix should be present in 0.99.1-2 too [2].

Please let me know if you still run into the same problem.

Cheers,
Reinier

[1] http://matplotlib.sourceforge.net/faq/installing_faq.html#install-from-svn
[2] 
http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-0.99.1/

On Wed, Jan 27, 2010 at 3:08 AM, Derek Schuff <dsch...@purdue.edu> wrote:
> Hi all,
> I'm getting strange errors trying to use the bar3d method in mplot3d
> (I'm using matplotlib 0.99.0 in Ubuntu 9.10 and Python 2.6).
> I'm doing something roughly like the example at
> http://matplotlib.sourceforge.net/examples/mplot3d/hist3d_demo.html
> I've pasted my sample program below, which has 2 cases: In case 1, you
> see just what you would expect: 2 rows of bars with increasing size in
> the y direction. if you uncomment case 2 (for different bar heights),
> you get the following error:
>
> Traceback (most recent call last):
>  File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_gtk.py",
> line 352, in expose_event
>    self._render_figure(self._pixmap, w, h)
>  File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_gtkagg.py",
> line 75, in _render_figure
>    FigureCanvasAgg.draw(self)
>  File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_agg.py",
> line 314, in draw
>    self.figure.draw(self.renderer)
>  File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 46,
> in draw_wrapper
>    draw(artist, renderer, *kl)
>  File "/usr/lib/pymodules/python2.6/matplotlib/figure.py", line 774, in draw
>    for a in self.axes: a.draw(renderer)
>  File "/usr/lib/pymodules/python2.6/mpl_toolkits/mplot3d/axes3d.py",
> line 135, in draw
>    for col in self.collections]
>  File "/usr/lib/pymodules/python2.6/mpl_toolkits/mplot3d/art3d.py",
> line 334, in do_3d_projection
>    z_segments_2d.sort(reverse=True)
> ValueError: The truth value of an array with more than one element is
> ambiguous. Use a.any() or a.all()
>
> This error gets thrown any time the 2 bars in the same y position have
> exactly the same z value: in the sample program the (0,0) value and
> (0,1) value are both 1 but it works for any of the 4 pairs. The error
> is particularly confusing. even looking at the source of the sort line
> in the backtrace, it's not clear where any arrays are being used as
> truth values. (just compared for the sort). This can be worked around
> by adding a tiny delta to the z values in one of the rows: it only
> errors when the corresponding z values match exactly.
> Am I doing something wrong here? or is this some kind of bug in the
> drawing code?
> thanks,
> -Derek
>
> the program:
> #!/usr/bin/env python2.6
> import matplotlib.pyplot as plot
> import mpl_toolkits.mplot3d
> import numpy
> fig2 = plot.figure()
> ax2 = mpl_toolkits.mplot3d.Axes3D(fig2)
> xpos = numpy.asarray([0, 1, 2, 4, 0, 1, 2, 4])
> ypos = numpy.asarray([0, 0, 0, 0, 1, 1, 1, 1])
> zpos = numpy.zeros_like(xpos)
> dx = 0.05 * numpy.ones_like(zpos)
> dy = numpy.ones_like(zpos)
> #case 1
> dz = numpy.asarray([1,2,3,4,5,6,7,8])
> #case 2
> #dz = numpy.asarray([1,2,3,4,1,6,7,8])
> ax2.bar3d(ypos, xpos, zpos, dy, dx, dz, color='b')
> ax2.set_xlabel('X')
> ax2.set_ylabel('Y')
> ax2.set_zlabel('Z')
> plot.show()
>
> ------------------------------------------------------------------------------
> The Planet: dedicated and managed hosting, cloud storage, colocation
> Stay online with enterprise data centers and the best network in the business
> Choose flexible plans and management services without long-term contracts
> Personal 24x7 support from experience hosting pros just a phone call away.
> http://p.sf.net/sfu/theplanet-com
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>



-- 
Reinier Heeres
Tel: +31 6 10852639

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to