Artefacts in contour plot?

Hi,

When trying to plot the contours of the famous Rosenbrock function:

···

----------------------------------------
from matplotlib.pylab import *

def rosenbrock(x,y):
     return 10.0 * (y-x**2)**2 + (x-1)**2

x = arange( -1.5, 1.5, 0.01 )
y = arange( -0.5, 1.5, 0.01 )
[X,Y] = meshgrid( x, y )
Z = rosenbrock( X, Y )
contour( Z, x=X, y=Y, levels = 50 )
show()
----------------------------------------

I notice some spurious zigzagging lines towards the top of the plot. Any idea where those might be coming from?

Also, the figure produced by the above script is flipped horizontally. The corresponding Matlab script produces the correct plot.

Thanks,
Dominique

I don't get any zig-zag lines on my box when I run your code...

as for being sideways, I cant tell since I don't have matlab here...

I don't have a solution, but it doesn't seem to be a matplotlib problem.

I am running, version 0.70.1

good luck,

Flávio

···

On Friday 14 January 2005 14:48, Dominique Orban wrote:

Hi,

When trying to plot the contours of the famous Rosenbrock function:

----------------------------------------
from matplotlib.pylab import *

def rosenbrock(x,y):
     return 10.0 * (y-x**2)**2 + (x-1)**2

x = arange( -1.5, 1.5, 0.01 )
y = arange( -0.5, 1.5, 0.01 )
[X,Y] = meshgrid( x, y )
Z = rosenbrock( X, Y )
contour( Z, x=X, y=Y, levels = 50 )
show()
----------------------------------------

I notice some spurious zigzagging lines towards the top of the plot. Any
idea where those might be coming from?

Also, the figure produced by the above script is flipped horizontally.
The corresponding Matlab script produces the correct plot.

Thanks,
Dominique

-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options