@@ -1602,25 +1602,37 @@ def subplots(self, nrows=1, ncols=1, sharex=False, sharey=False,
1602
1602
return axarr
1603
1603
1604
1604
def _remove_ax (self , ax ):
1605
- def _reset_loc_form (axis ):
1605
+ def _reset_locators_and_formatters (axis ):
1606
1606
# Set the formatters and locators to be associated with axis
1607
1607
# (where previously they may have been associated with another
1608
1608
# 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.
1609
1613
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
1612
1618
1613
1619
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
1616
1624
1617
1625
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
1620
1630
1621
1631
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
1624
1636
1625
1637
def _break_share_link (ax , grouper ):
1626
1638
siblings = grouper .get_siblings (ax )
@@ -1634,11 +1646,11 @@ def _break_share_link(ax, grouper):
1634
1646
self .delaxes (ax )
1635
1647
last_ax = _break_share_link (ax , ax ._shared_y_axes )
1636
1648
if last_ax is not None :
1637
- _reset_loc_form (last_ax .yaxis )
1649
+ _reset_locators_and_formatters (last_ax .yaxis )
1638
1650
1639
1651
last_ax = _break_share_link (ax , ax ._shared_x_axes )
1640
1652
if last_ax is not None :
1641
- _reset_loc_form (last_ax .xaxis )
1653
+ _reset_locators_and_formatters (last_ax .xaxis )
1642
1654
1643
1655
def clf (self , keep_observers = False ):
1644
1656
"""
0 commit comments