Skip to content

Commit 9d05ef3

Browse files
author
Jeff Whitaker
committed
fix warpimage and projection = 'hammer' (issue 100)
1 parent d0bd073 commit 9d05ef3

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/mpl_toolkits/basemap/__init__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4089,7 +4089,8 @@ def warpimage(self,image="bluemarble",scale=None,**kwargs):
40894089
# make points outside projection limb transparent.
40904090
self._bm_rgba_warped = self._bm_rgba_warped.filled(0.)
40914091
# treat pseudo-cyl projections such as mollweide, robinson and sinusoidal.
4092-
elif self.projection in _pseudocyl:
4092+
elif self.projection in _pseudocyl:
4093+
if self.projection != 'hammer':
40934094
lonsr,latsr = self(x,y,inverse=True)
40944095
mask = ma.zeros((ny,nx,4),np.int8)
40954096
lon_0 = self.projparams['lon_0']
@@ -4112,6 +4113,12 @@ def warpimage(self,image="bluemarble",scale=None,**kwargs):
41124113
self._bm_rgba_warped = self._bm_rgba_warped.filled(0.)
41134114
# plot warped rgba image.
41144115
im = self.imshow(self._bm_rgba_warped,ax=ax,**kwargs)
4116+
# for hammer projection, use clip path defined by
4117+
# projection limb (patch created in drawmapboundary).
4118+
if self.projection == 'hammer':
4119+
if not self._mapboundarydrawn:
4120+
self.drawmapboundary(color='none',linewidth=None)
4121+
im.set_clip_path(self._mapboundarydrawn)
41154122
else:
41164123
# bmproj True, no interpolation necessary.
41174124
im = self.imshow(self._bm_rgba,ax=ax,**kwargs)

0 commit comments

Comments
 (0)