@@ -1596,25 +1596,37 @@ def subplots(self, nrows=1, ncols=1, sharex=False, sharey=False,
15961596 return axarr
15971597
15981598 def _remove_ax (self , ax ):
1599- def _reset_loc_form (axis ):
1599+ def _reset_locators_and_formatters (axis ):
16001600 # Set the formatters and locators to be associated with axis
16011601 # (where previously they may have been associated with another
16021602 # Axis isntance)
1603+ #
1604+ # Because set_major_formatter() etc. force isDefault_* to be False,
1605+ # we have to manually check if the original formatter was a
1606+ # default and manually set isDefault_* if that was the case.
16031607 majfmt = axis .get_major_formatter ()
1604- if not majfmt .axis .isDefault_majfmt :
1605- axis .set_major_formatter (majfmt )
1608+ isDefault = majfmt .axis .isDefault_majfmt
1609+ axis .set_major_formatter (majfmt )
1610+ if isDefault :
1611+ majfmt .axis .isDefault_majfmt = True
16061612
16071613 majloc = axis .get_major_locator ()
1608- if not majloc .axis .isDefault_majloc :
1609- axis .set_major_locator (majloc )
1614+ isDefault = majloc .axis .isDefault_majloc
1615+ axis .set_major_locator (majloc )
1616+ if isDefault :
1617+ majloc .axis .isDefault_majloc = True
16101618
16111619 minfmt = axis .get_minor_formatter ()
1612- if not minfmt .axis .isDefault_minfmt :
1613- axis .set_minor_formatter (minfmt )
1620+ isDefault = majloc .axis .isDefault_minfmt
1621+ axis .set_minor_formatter (minfmt )
1622+ if isDefault :
1623+ minfmt .axis .isDefault_minfmt = True
16141624
16151625 minloc = axis .get_minor_locator ()
1616- if not minfmt .axis .isDefault_minloc :
1617- axis .set_minor_locator (minloc )
1626+ isDefault = majloc .axis .isDefault_minloc
1627+ axis .set_minor_locator (minloc )
1628+ if isDefault :
1629+ minloc .axis .isDefault_minloc = True
16181630
16191631 def _break_share_link (ax , grouper ):
16201632 siblings = grouper .get_siblings (ax )
@@ -1628,11 +1640,11 @@ def _break_share_link(ax, grouper):
16281640 self .delaxes (ax )
16291641 last_ax = _break_share_link (ax , ax ._shared_y_axes )
16301642 if last_ax is not None :
1631- _reset_loc_form (last_ax .yaxis )
1643+ _reset_locators_and_formatters (last_ax .yaxis )
16321644
16331645 last_ax = _break_share_link (ax , ax ._shared_x_axes )
16341646 if last_ax is not None :
1635- _reset_loc_form (last_ax .xaxis )
1647+ _reset_locators_and_formatters (last_ax .xaxis )
16361648
16371649 def clf (self , keep_observers = False ):
16381650 """
0 commit comments