Simon Kammerer wrote:
Hi list,
is there a way to fill continents with basemap an then use contourf to draw filled contours over the continents?
Its useless when the filled contours cover the whole map, but when only parts of the map are covered with filled contours, it would be nice to paint over the continents (but still let the coastlines and countries shine through the filled contours).
Thanks for any hints
Simon
-
Simon: I just added a zorder keyword to fillcontinents in basemap SVN:
--- basemap.py (revision 3192)
+++ basemap.py (working copy)
@@ -1299,7 +1299,7 @@
# set axes limits to fit map region.
self.set_axes_limits(ax=ax)
- def fillcontinents(self,color='0.8',ax=None):
+ def fillcontinents(self,color='0.8',ax=None,zorder=1):
"""
Fill continents.
@@ -1342,9 +1342,9 @@
if not hasp1 or not hasp2 or not hasp3 or not hasp4:
xy = zip(xa.tolist(),ya.tolist())
if self.coastpolygontypes[np] != 2:
- poly = Polygon(xy,facecolor=color,edgecolor=color,linewidth=0)
+ poly = Polygon(xy,facecolor=color,edgecolor=color,linewidth=0,zorder=zorder)
else: # lakes filled with background color.
- poly = Polygon(xy,facecolor=axisbgc,edgecolor=axisbgc,linewidth=0)
+ poly = Polygon(xy,facecolor=axisbgc,edgecolor=axisbgc,linewidth=0,zorder=zorder)
ax.add_patch(poly)
np = np + 1
You can now set zorder=0 if you want contourf to paint over the filled continents.
-Jeff
···
--
Jeffrey S. Whitaker Phone : (303)497-6313
NOAA/OAR/CDC R/PSD1 FAX : (303)497-6449
325 Broadway Boulder, CO, USA 80305-3328