Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions lib/mpl_toolkits/basemap/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1330,6 +1330,7 @@ def drawmapboundary(self,color='k',linewidth=1.0,fill_color=None,\
ax.set_frame_on(False)
# elliptical region.
ax.add_patch(limb)
self._mapboundarydrawn = limb
if fill_color is None:
limb.set_fill(False)
else:
Expand Down Expand Up @@ -1365,6 +1366,7 @@ def drawmapboundary(self,color='k',linewidth=1.0,fill_color=None,\
xy = list(zip(x,y))
limb = Polygon(xy,edgecolor=color,linewidth=linewidth)
ax.add_patch(limb)
self._mapboundarydrawn = limb
if fill_color is None:
limb.set_fill(False)
else:
Expand All @@ -1378,6 +1380,7 @@ def drawmapboundary(self,color='k',linewidth=1.0,fill_color=None,\
limb = Circle((0.5*(self.xmax+self.xmin),0.5*(self.ymax+self.ymin)),
radius=0.5*(self.xmax-self.xmin),fc='none')
ax.add_patch(limb)
self._mapboundarydrawn = limb
if fill_color is None:
limb.set_fill(False)
else:
Expand Down Expand Up @@ -1430,6 +1433,7 @@ def drawmapboundary(self,color='k',linewidth=1.0,fill_color=None,\
# draw and fill map projection limb, clipped
# to rectangular region.
ax.add_patch(limb)
self._mapboundarydrawn = limb
if fill_color is None:
limb.set_fill(False)
else:
Expand All @@ -1441,7 +1445,6 @@ def drawmapboundary(self,color='k',linewidth=1.0,fill_color=None,\
limb.set_zorder(zorder)
limb.set_clip_on(True)
# set axes limits to fit map region.
self._mapboundarydrawn = True
self.set_axes_limits(ax=ax)
return limb

Expand Down Expand Up @@ -2819,19 +2822,20 @@ def set_axes_limits(self,ax=None):
ax.set_ylim((self.llcrnry, self.urcrnry))
# if map boundary not yet drawn, draw it with default values.
if not self._mapboundarydrawn:
# elliptical map, turn off axis_frame, draw boundary manually.
if (self.projection in ['ortho','geos','nsper','aeqd'] and
self._fulldisk) or self.round or self.projection in _pseudocyl:
# turn off axes frame.
ax.set_frame_on(False)
# first draw boundary, no fill
limb1 = self.drawmapboundary(fill_color='none')
# draw another filled patch, with no boundary.
limb2 = self.drawmapboundary(linewidth=0)
self._mapboundarydrawn = True
# is the map boundary already drawn on the current axes?
if self._mapboundarydrawn not in ax.patches:
# elliptical map, turn off axis_frame, draw boundary manually.
if (self.projection in ['ortho','geos','nsper','aeqd'] and
self._fulldisk) or self.round or self.projection in _pseudocyl:
# turn off axes frame.
ax.set_frame_on(False)
# first draw boundary, no fill
limb1 = self.drawmapboundary(fill_color='none')
# draw another filled patch, with no boundary.
limb2 = self.drawmapboundary(linewidth=0)
self._mapboundarydrawn = True
else: # square map, just turn on axis frame.
ax.set_frame_on(True)
self._mapboundarydrawn = True
# make sure aspect ratio of map preserved.
# plot is re-centered in bounding rectangle.
# (anchor instance var determines where plot is placed)
Expand Down
6 changes: 3 additions & 3 deletions lib/mpl_toolkits/basemap/geodesicline.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class GeodesicLine(object):
"""Points on a geodesic path"""

def __init__(self, geod, lat1, lon1, azi1, caps = GeodesicCapability.ALL):
from pyproj.geodesic import Geodesic
from mpl_toolkits.basemap.geodesic import Geodesic
self._a = geod._a
self._f = geod._f
self._b = geod._b
Expand Down Expand Up @@ -137,7 +137,7 @@ def __init__(self, geod, lat1, lon1, azi1, caps = GeodesicCapability.ALL):
# return a12, lat2, lon2, azi2, s12, m12, M12, M21, S12
def GenPosition(self, arcmode, s12_a12, outmask):

from pyproj.geodesic import Geodesic
from mpl_toolkits.basemap.geodesic import Geodesic
a12 = lat2 = lon2 = azi2 = s12 = m12 = M12 = M21 = S12 = Math.nan
outmask &= self._caps & Geodesic.OUT_ALL
if not (arcmode or (self._caps & Geodesic.DISTANCE_IN & Geodesic.OUT_ALL)):
Expand Down Expand Up @@ -312,7 +312,7 @@ def Position(self, s12,
Geodesic.ALL
"""

from pyproj.geodesic import Geodesic
from mpl_toolkits.basemap.geodesic import Geodesic
Geodesic.CheckDistance(s12)
result = {'lat1': self._lat1, 'lon1': self._lon1, 'azi1': self._azi1,
's12': s12}
Expand Down
4 changes: 2 additions & 2 deletions lib/mpl_toolkits/basemap/polygonarea.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class PolygonArea(object):
def transit(lon1, lon2):
# Return 1 or -1 if crossing prime meridian in east or west direction.
# Otherwise return zero.
from pyproj.geodesic import Geodesic
from mpl_toolkits.basemap.geodesic import Geodesic
lon1 = Geodesic.AngNormalize(lon1)
lon2 = Geodesic.AngNormalize(lon2)
# treat lon12 = -180 as an eastward geodesic, so convert to 180.
Expand All @@ -38,7 +38,7 @@ def transit(lon1, lon2):
transit = staticmethod(transit)

def __init__(self, earth, polyline = False):
from pyproj.geodesic import Geodesic
from mpl_toolkits.basemap.geodesic import Geodesic
self._earth = earth
self._area0 = 4 * math.pi * earth._c2
self._polyline = polyline
Expand Down