@@ -1602,25 +1602,37 @@ def subplots(self, nrows=1, ncols=1, sharex=False, sharey=False,
16021602 return axarr
16031603
16041604 def _remove_ax (self , ax ):
1605- def _reset_loc_form (axis ):
1605+ def _reset_locators_and_formatters (axis ):
16061606 # Set the formatters and locators to be associated with axis
16071607 # (where previously they may have been associated with another
16081608 # Axis isntance)
1609+ #
1610+ # Because set_major_formatter() etc. force isDefault_* to be False,
1611+ # we have to manually check if the original formatter was a
1612+ # default and manually set isDefault_* if that was the case.
16091613 majfmt = axis .get_major_formatter ()
1610- if not majfmt .axis .isDefault_majfmt :
1611- axis .set_major_formatter (majfmt )
1614+ isDefault = majfmt .axis .isDefault_majfmt
1615+ axis .set_major_formatter (majfmt )
1616+ if isDefault :
1617+ majfmt .axis .isDefault_majfmt = True
16121618
16131619 majloc = axis .get_major_locator ()
1614- if not majloc .axis .isDefault_majloc :
1615- axis .set_major_locator (majloc )
1620+ isDefault = majloc .axis .isDefault_majloc
1621+ axis .set_major_locator (majloc )
1622+ if isDefault :
1623+ majloc .axis .isDefault_majloc = True
16161624
16171625 minfmt = axis .get_minor_formatter ()
1618- if not minfmt .axis .isDefault_minfmt :
1619- axis .set_minor_formatter (minfmt )
1626+ isDefault = majloc .axis .isDefault_minfmt
1627+ axis .set_minor_formatter (minfmt )
1628+ if isDefault :
1629+ minfmt .axis .isDefault_minfmt = True
16201630
16211631 minloc = axis .get_minor_locator ()
1622- if not minfmt .axis .isDefault_minloc :
1623- axis .set_minor_locator (minloc )
1632+ isDefault = majloc .axis .isDefault_minloc
1633+ axis .set_minor_locator (minloc )
1634+ if isDefault :
1635+ minloc .axis .isDefault_minloc = True
16241636
16251637 def _break_share_link (ax , grouper ):
16261638 siblings = grouper .get_siblings (ax )
@@ -1634,11 +1646,11 @@ def _break_share_link(ax, grouper):
16341646 self .delaxes (ax )
16351647 last_ax = _break_share_link (ax , ax ._shared_y_axes )
16361648 if last_ax is not None :
1637- _reset_loc_form (last_ax .yaxis )
1649+ _reset_locators_and_formatters (last_ax .yaxis )
16381650
16391651 last_ax = _break_share_link (ax , ax ._shared_x_axes )
16401652 if last_ax is not None :
1641- _reset_loc_form (last_ax .xaxis )
1653+ _reset_locators_and_formatters (last_ax .xaxis )
16421654
16431655 def clf (self , keep_observers = False ):
16441656 """
0 commit comments