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
Pylab contourf plot using Mollweide projection create artefacts #1910
Comments
The strip in the image suggests that there has been a polygon which has transformed badly. I'm 95% confident that this is because of your X limits are +/- Pi which are both singularities on the Mollweide projection. Indeed, when I run your code (v1.3-dev), I get the following warning:
I've tried fiddling with the extents of the underlying data, but without much luck. Have you considered using one of the mapping toolkits (Basemap or cartopy)? |
I tried to restrict the range of the of X,Y. It does work for up to 99% of their boundary value. With 99.5% of (-pi/2, pi/2) and (-pi, pi) it shows even more artefacts. The same code using Basemap works perfectly. |
@pelson Should the contouring code expect to handle post-contouring transforms to the data space? I think this is going to be a tough nut to crack. |
@dmcdougall: I think the answer to your question is "would be nice", but not under the current implementation. |
This kinda looks like the polygon closing issue we fixed back in July for On Wed, Nov 26, 2014 at 3:11 PM, Thomas A Caswell notifications@github.com
|
Fixed as far back as 1.5.0! Might be interesting to track down when this was fixed (git bisect is fun!), but closing. |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
plt.ion()
ra = np.linspace(-np.pi, np.pi, 40)
dec= np.linspace(-np.pi/2, np.pi/2, 20)
X,Y = np.meshgrid(ra,dec)
Z = np.sin(X) * np.cos(X) * np.sin(Y) * np.cos(Y)
plt.figure()
ax = plt.subplot(111, projection = 'mollweide')
ax.contourf(X,Y,Z,100)
ax.contour(X,Y,Z,10,colors='k')
ax.set_title(matplotlib.__version__)
plt.show() |
matplotlib 1.1.1rc, python 2.7.3, Ubuntu 12.04 LTS
pylab.contourf create artefacts when used in a Mollweide projection.
Here is an example code:
Some of the points seem to be wrongly drawn (See Figure below).
The same code used without projection outputs a perfectly normal map:
You may have noticed that the contour lines work in both images. The artefacts seem to be always at the same place.
[Originally posted on Stackoverflow: http://stackoverflow.com/questions/16018243/pylab-contour-plot-using-mollweide-projection-create-artefacts ]
The text was updated successfully, but these errors were encountered: