@@ -1596,25 +1596,37 @@ def subplots(self, nrows=1, ncols=1, sharex=False, sharey=False,
1596
1596
return axarr
1597
1597
1598
1598
def _remove_ax (self , ax ):
1599
- def _reset_loc_form (axis ):
1599
+ def _reset_loc_from (axis ):
1600
1600
# Set the formatters and locators to be associated with axis
1601
1601
# (where previously they may have been associated with another
1602
1602
# 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.
1603
1607
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
1606
1612
1607
1613
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
1610
1618
1611
1619
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
1614
1624
1615
1625
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
1618
1630
1619
1631
def _break_share_link (ax , grouper ):
1620
1632
siblings = grouper .get_siblings (ax )
@@ -1628,11 +1640,11 @@ def _break_share_link(ax, grouper):
1628
1640
self .delaxes (ax )
1629
1641
last_ax = _break_share_link (ax , ax ._shared_y_axes )
1630
1642
if last_ax is not None :
1631
- _reset_loc_form (last_ax .yaxis )
1643
+ _reset_loc_from (last_ax .yaxis )
1632
1644
1633
1645
last_ax = _break_share_link (ax , ax ._shared_x_axes )
1634
1646
if last_ax is not None :
1635
- _reset_loc_form (last_ax .xaxis )
1647
+ _reset_loc_from (last_ax .xaxis )
1636
1648
1637
1649
def clf (self , keep_observers = False ):
1638
1650
"""
0 commit comments