-
Notifications
You must be signed in to change notification settings - Fork 391
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
contour and contourf produce conflicing results for certain projections #229
Comments
What version of matplotlib are you using? |
Am using version 1.5.0 of matplotlib. |
In your call to contourf, try adding the kwarg |
I added |
Is there any chance that those negative values are very small?? maybe could help? Cheers 2015-11-23 12:43 GMT-05:00 jhcsu [email protected]:
Sasha |
The negative values shown in the blue contours are not particularly small. The value at 50 degrees north, 255 degrees east (southern Saskatchewan), for example, is approximately -2.4:
|
On 2015/11/23 8:29 AM, jhcsu wrote:
Try one more thing (another shot in the dark): use floating point for |
I changed the code to |
This is odd. If I subset longitude starting at lon[30]=75.0 (which isn't even on the map!), it works. If I subset longitude at lon[29]=72.5 (or don't subset at all, as in my initial example), it doesn't. What is special about 75 degrees longitude? Let's demo by making a slight change just to this segment of the code. The following works:
The following does not (and looks exactly like my initial example):
|
Do the collection objects created by the |
Although I can't answer that question... I will clarify that no error is produced. If I didn't already have some expectation of what the output looked like, I would have incorrectly assumed it was correct. |
Originally posted here because I wasn't convinced it was a bug (I'm new to matplotlib)... but I'm increasingly convinced it is a bug, so here we are.
I'm plotting some NCEP temperature anomaly data using the stereographic projection. When I plot the data with filled contours, contourf, I see the first picture below. Note the red (positive values) over most of North America. When I change contourf to contour, making no other changes, I see the second picture below. Note the streak of blue (negative values) over central North America.
The contour result with the blue is what is actually in the data, and therefore what I expect to see. The contourf result is not what I expect. Is this a bug, or am I using these tools improperly? (Update: The first plot above should look like the below plot, which was produced using the cylindrical projection:)
The python code is reproduced below... you can obtain the data as a small binary file here if you want to try it yourself.
Some more notes... (1) shifting the longitude range to -180 to 180 using
addcyclic
andshiftgrid
does not help. (2) the Lambert Conformal ('lcc') projection produces results that are less wrong, but still not correct, when using contourf. (3) the Alberts Equal Area ('aea') projection centered on North America looks correct, however when I use the North Pole-centric version ('nplaea') I only see correct results for certain values oflon_0
. I am happy to provide an example if this turns out to be a different issue.The text was updated successfully, but these errors were encountered: