Skip to content

Commit

Permalink
Fix Axes clearing with Matplotlib 3.6+
Browse files Browse the repository at this point in the history
  • Loading branch information
QuLogic committed Aug 27, 2022
1 parent 357bd6b commit b022485
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions lib/cartopy/mpl/geoaxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,9 +575,8 @@ def _update_title_position(self, renderer):
def __str__(self):
return '< GeoAxes: %s >' % self.projection

def cla(self):
"""Clear the current axes and adds boundary lines."""
result = super().cla()
def __clear(self):
"""Clear the current axes and add boundary lines."""
self.xaxis.set_visible(False)
self.yaxis.set_visible(False)
# Enable tight autoscaling.
Expand All @@ -593,7 +592,18 @@ def cla(self):
self.dataLim.intervalx = self.projection.x_limits
self.dataLim.intervaly = self.projection.y_limits

return result
if mpl.__version__ >= '3.6':
def clear(self):
"""Clear the current Axes and add boundary lines."""
result = super().clear()
self.__clear()
return result
else:
def cla(self):
"""Clear the current Axes and add boundary lines."""
result = super().cla()
self.__clear()
return result

def format_coord(self, x, y):
"""
Expand Down

0 comments on commit b022485

Please sign in to comment.