File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -1804,3 +1804,24 @@ def test_set_offset_string(formatter):
1804
1804
assert formatter .get_offset () == ''
1805
1805
formatter .set_offset_string ('mpl' )
1806
1806
assert formatter .get_offset () == 'mpl'
1807
+
1808
+
1809
+ def test_minorticks_on_multi_fig ():
1810
+ """
1811
+ Turning on minor gridlines in a multi-Axes Figure
1812
+ that contains more than one boxplot and shares the x-axis
1813
+ should not raise an exception.
1814
+ """
1815
+ fig , ax = plt .subplots ()
1816
+
1817
+ ax .boxplot (np .arange (10 ), positions = [0 ])
1818
+ ax .boxplot (np .arange (10 ), positions = [0 ])
1819
+ ax .boxplot (np .arange (10 ), positions = [1 ])
1820
+
1821
+ ax .grid (which = "major" )
1822
+ ax .grid (which = "minor" )
1823
+ ax .minorticks_on ()
1824
+ fig .draw_without_rendering ()
1825
+
1826
+ assert ax .get_xgridlines ()
1827
+ assert isinstance (ax .xaxis .get_minor_locator (), mpl .ticker .AutoMinorLocator )
Original file line number Diff line number Diff line change @@ -2903,7 +2903,7 @@ def __call__(self):
2903
2903
_api .warn_external ('AutoMinorLocator does not work on logarithmic scales' )
2904
2904
return []
2905
2905
2906
- majorlocs = self .axis .get_majorticklocs ()
2906
+ majorlocs = np . unique ( self .axis .get_majorticklocs () )
2907
2907
if len (majorlocs ) < 2 :
2908
2908
# Need at least two major ticks to find minor tick locations.
2909
2909
# TODO: Figure out a way to still be able to display minor ticks with less
You can’t perform that action at this time.
0 commit comments