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
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
If there is any advice in this email, it is general advice only and has been prepared by Macquarie Group or one of its related entities (“Macquarie”).
Macquarie has made every reasonable effort to ensure the information provided is correct, but Macquarie makes no representation nor any warranty as to whether the information is accurate, complete or up to date. To the extent permitted by law, Macquarie accepts no responsibility for any errors or misstatements, negligent or otherwise. The information provided may be based on assumptions or market conditions and may change without notice.
Macquarie, its associates, officers or employees may also have interests in the financial products referred to in this information by acting in various roles. They may buy or sell the financial products as principal or agent and as such may effect transactions which are not consistent with any recommendations (if any in this information). Macquarie or its associates may also receive fees or brokerage for acting in the above capacities.
The information in this email is confidential. If you are not the intended recipient, you are not authorised to use the information in this email in any way. Macquarie does not guarantee the integrity of any emails or attached files. The view or opinions expressed are the author’s own and may not reflect the view or opinions of Macquarie.
Electronic communications carried within the Macquarie system may be monitored.