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 @@ -1797,3 +1797,24 @@ def test_set_offset_string(formatter):
17971797 assert formatter .get_offset () == ''
17981798 formatter .set_offset_string ('mpl' )
17991799 assert formatter .get_offset () == 'mpl'
1800+
1801+
1802+ def test_minorticks_on_multi_fig ():
1803+ """
1804+ Turning on minor gridlines in a multi-Axes Figure
1805+ that contains more than one boxplot and shares the x-axis
1806+ should not raise an exception.
1807+ """
1808+ fig , ax = plt .subplots ()
1809+
1810+ ax .boxplot (np .arange (10 ), positions = [0 ])
1811+ ax .boxplot (np .arange (10 ), positions = [0 ])
1812+ ax .boxplot (np .arange (10 ), positions = [1 ])
1813+
1814+ ax .grid (which = "major" )
1815+ ax .grid (which = "minor" )
1816+ ax .minorticks_on ()
1817+ fig .draw_without_rendering ()
1818+
1819+ assert ax .get_xgridlines ()
1820+ assert isinstance (ax .xaxis .get_minor_locator (), mpl .ticker .AutoMinorLocator )
Original file line number Diff line number Diff line change @@ -2895,7 +2895,7 @@ def __call__(self):
28952895 'logarithmic scale' )
28962896 return []
28972897
2898- majorlocs = self .axis .get_majorticklocs ()
2898+ majorlocs = np . unique ( self .axis .get_majorticklocs () )
28992899 try :
29002900 majorstep = majorlocs [1 ] - majorlocs [0 ]
29012901 except IndexError :
You can’t perform that action at this time.
0 commit comments