I have tried using the first cookbook example for basemap from the scipy website and the oceans are incorrectly getting filled in. Attached is a script to reproduce the issue, and the output that I obtain. I am using basemap r8719 and matplotlib r8763.
SourceForge Comments
On Sun Jan 2 09:57:56 2011, jswhit wrote:
Yes, this is a bug (as noted in the KNOWN_BUGS file) that unfortunately has plagued me for years and probably has no solution. The only workaround is to slightly adjust the center of the plot (in your case changing lon_0 from 50 to 45 fixes it), or use drawlsmask instead of fillcontinents.
On Thu Nov 18 00:30:28 2010, robitaille wrote:
I don't use basemap much, so the bug doesn't really affect me, but it seemed strange that this occured on a pretty standard Earth view, not a specific zoom-in like the one mentioned in the "KNOWN_BUGS". The fact that it worked when the cookbook was written suggests a bug was maybe introduced in the mean time?
On Thu Nov 11 22:25:12 2010, weathergod wrote:
I believe this is a known issue. From the source code in a file called "KNOWN_BUGS":
The fillcontinents method doesn't always do the right thing. Matplotlib
always tries to fill the inside of a polygon. Under certain situations,
what is the inside of a coastline polygon can be ambiguous, and the
outside may be filled instead of the inside. To trigger this,
run the garp.py example with lon=-71,lat=-33 (Santiago, Chile).
Workaround - mask the land areas with the drawlsmask method instead of
filling the coastline polygons.
Not to say that it isn't a bug, but rather it is a very difficult one to definittively/completely eradicate. Could you try the drawlsmask method to see if that is sufficient for you?
On Wed Oct 27 12:12:54 2010, robitaille wrote:
The fig.add_axes() should be fig.add_subplot(1,1,1) but this does not make any difference.
SourceForge History
On Sun Jan 2 09:57:56 2011, by jswhit: resolution_id: 100
On Wed Oct 27 12:11:10 2010, by robitaille: File Added: 391380: test.png
On Wed Oct 27 12:10:27 2010, by robitaille: File Added: 391379: test_basemap.py
This issue is largely fixed in github master. There are still cases when the the continent fill fails, but it is now much harder to trigger. I believe the case in the OP now works.
Activity
pelson commented on Apr 16, 2012
@jswhit (and others): Seems like this belongs in https://github.com/matplotlib/basemap rather than here. Suggest the issue is closed.
jswhit commented on Apr 21, 2012
This issue is largely fixed in github master. There are still cases when the the continent fill fails, but it is now much harder to trigger. I believe the case in the OP now works.