From: Dominique O. <Dom...@po...> - 2005-01-14 16:49:08
|
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 |