I tried a simple array (see the code below) but cannot reproduce the
problem you reported.
import matplotlib.pyplot as plt
import numpy as np
arr = np.zeros((11, 11), dtype="d")
im = plt.imshow(arr, interpolation="nearest", origin="lower")
cont = plt.contour(arr, levels=[0.5])
Do you still see the shift with the above example code?
And what version of matplotlib are you using?
If possible, please post a complete script with the data (use a
mock-up data if you want)?
On Fri, Jul 23, 2010 at 12:16 AM, Jenna Lemonias <jenna@...2124...> wrote:
No, I don't think the issue is a flip in the y-axis. I have a number of
different examples of this, and many in which the contour is an ellipse so I
can tell that the overall positioning is correct. It seems like something
is going wrong only when I save the image... Thanks for the suggestion
On Wed, Jul 21, 2010 at 3:40 PM, Jenna Lemonias > <jenna@...2124...>wrote:
I am trying to save a matplotlib 2d array image with an overlaid contour
an eps file. The contour appears to be shifted with respect to the image
underneath in the eps file, particularly when I zoom in on the image.
shift is not noticeable in the plot within matplotlib.
I am using imshow to display the image. The contour is created by
a list of closely-spaced x,y coordinates. The attached file
is a screenshot of the (zoomed-in) image as displayed by matplotlib. The
attached file epsfile.png is a screenshot of the (zoomed-in) eps file.
I save this image as an eps file, it is actually 1 of 20 subplots and the
shift is noticeable in each subplot.
Thanks in advance for your help!
Just as a wild guess, could this actually be an issue with how imshow uses
the upper-left corner for (0,0)? I have seen 1-pixel shifts before, but
this shift is a little dramatic and I am left wondering if what we are
really seeing is that the contour that is desired should actually be fliped
in the y-axis?
Maybe you could try another example where you try to draw a contour further
away from the center of the image and see if it still goes in the spot you
expect it to be?
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
Matplotlib-users mailing list