On Tue, Jul 12, 2011 at 12:53 AM, Kirill Lapshin (Macquarie Securities) <
kirill.laps...@macquarie.com> wrote:

> **
> Hello,
>
> We've encountered a problem plotting a nearly flat surface. Interestingly
> exactly flat surface can be plotted just fine, so it seems the bug is
> triggered when a range of values on z axis is very narrow. The problem can
> be easily reproduced on 32-bit windows and 64-bit linux, the only platforms
> I have handy, so most likely it is not platform specific. Both platforms
> have Python 2.6 and Matplotlb 1.0.1, and I've also seen the same error on
> Windows with Matplotlib 1.0.0. Here is a simplified repro:
>
> ------
> from matplotlib import pyplot
> from mpl_toolkits.mplot3d import axes3d
> import numpy
>
> n = 3
> m = 4
> x = range(n)
> y = range(m)
> z = [ 0.2999999999999 for i in range(n*m) ]
> z[1] = 0.3 # comment this line to make it pass
>
> figure = pyplot.figure( 0 )
> ax = axes3d.Axes3D( figure )
> x = numpy.array( [ [ t ] * m for t in x ] )
> y = numpy.array( [ y ] * n )
> z = numpy.array( z )
> z = z.reshape( [ n, m ] )
> wire = ax.plot_wireframe( x, y, z )
> figure.show()
> pyplot.draw()
> -----
>
> Here is a traceback:
>
> ----
> Traceback (most recent call last):
>   File "C:\plotbug.py", line 21, in <module>
>     pyplot.draw()
>   File "C:\Python26\lib\site-packages\matplotlib\pyplot.py", line 358, in
> draw
>     get_current_fig_manager().canvas.draw()
>   File
> "C:\Python26\lib\site-packages\matplotlib\backends\backend_tkagg.py", line
> 248, in draw
>     FigureCanvasAgg.draw(self)
>   File "C:\Python26\lib\site-packages\matplotlib\backends\backend_agg.py",
> line 394, in draw
>     self.figure.draw(self.renderer)
>   File "C:\Python26\lib\site-packages\matplotlib\artist.py", line 55, in
> draw_wrapper
>     draw(artist, renderer, *args, **kwargs)
>   File "C:\Python26\lib\site-packages\matplotlib\figure.py", line 798, in
> draw
>     func(*args)
>   File "C:\Python26\lib\site-packages\mpl_toolkits\mplot3d\axes3d.py", line
> 172, in draw
>     ax.draw(renderer)
>   File "C:\Python26\lib\site-packages\mpl_toolkits\mplot3d\axis3d.py", line
> 243, in draw
>     newval = get_flip_min_max(xyz1[0], newindex, mins, maxs)
> IndexError: list index out of range
> ----
>
> If you comment out "z[1] = 0.3" line, and therefore make surface perfectly
> flat, then it will plot just fine.
> Any help would be greatly appreciated.
>
> Kind regards,
>
> Kirill Lapshin
>

Kirill,

Thanks for the report.  I am able to confirm that the problem occurs with
v1.0.1, however, it appears that it is solved in the current development
trunk and will work properly in the upcoming v1.1.0 release.  I am not 100%
certain which change it was that fixes this, but it is likely due to my work
to make mplot3d functions accept empty inputs.  This change would have
likely allowed mplot3d to skip some operations under certain conditions.

Because of the significant work that has gone into mplot3d since the v1.0.0
release, I would recommend all mplot3d users to upgrade to v1.1 when it is
released.

I hope this helps!
Ben Root
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to