|
12 | 12 | import matplotlib.pyplot as plt
|
13 | 13 | import matplotlib.ticker as mticker
|
14 | 14 |
|
15 |
| -import random |
16 |
| - |
17 | 15 |
|
18 | 16 | class TestMaxNLocator:
|
19 | 17 | basic_data = [
|
@@ -1806,23 +1804,16 @@ def test_minorticks_on_multi_fig():
|
1806 | 1804 | that contains more than one boxplot and shares the x-axis
|
1807 | 1805 | should not raise an exception.
|
1808 | 1806 | """
|
1809 |
| - fig, ax = plt.subplots(sharex=True, ncols=2, nrows=2) |
1810 |
| - |
1811 |
| - def values(): |
1812 |
| - return [random.random() for _ in range(9)] |
1813 |
| - |
1814 |
| - for x in range(3): |
1815 |
| - ax[0, 0].boxplot(values(), positions=[x]) |
1816 |
| - ax[0, 1].boxplot(values(), positions=[x]) |
1817 |
| - ax[1, 0].boxplot(values(), positions=[x]) |
1818 |
| - ax[1, 1].boxplot(values(), positions=[x]) |
1819 |
| - |
1820 |
| - for a in ax.flatten(): |
1821 |
| - a.grid(which="major") |
1822 |
| - a.grid(which="minor", linestyle="--") |
1823 |
| - a.minorticks_on() |
1824 |
| - fig.canvas.draw() |
1825 |
| - |
1826 |
| - assert all(a.get_xgridlines() for a in ax.flatten()) |
1827 |
| - assert all((isinstance(a.xaxis.get_minor_locator(), mpl.ticker.AutoMinorLocator) |
1828 |
| - for a in ax.flatten())) |
| 1807 | + fig, ax = plt.subplots() |
| 1808 | + |
| 1809 | + ax.boxplot(np.arange(10), positions=[0]) |
| 1810 | + ax.boxplot(np.arange(10), positions=[0]) |
| 1811 | + ax.boxplot(np.arange(10), positions=[1]) |
| 1812 | + |
| 1813 | + ax.grid(which="major") |
| 1814 | + ax.grid(which="minor") |
| 1815 | + ax.minorticks_on() |
| 1816 | + fig.draw_without_rendering() |
| 1817 | + |
| 1818 | + assert ax.get_xgridlines() |
| 1819 | + assert isinstance(ax.xaxis.get_minor_locator(), mpl.ticker.AutoMinorLocator) |
0 commit comments