(remove_overlapping_locs, expected_num)
| 1889 | (None, 6), # this tests the default |
| 1890 | (False, 9))) |
| 1891 | def test_remove_overlap(remove_overlapping_locs, expected_num): |
| 1892 | t = np.arange("2018-11-03", "2018-11-06", dtype="datetime64") |
| 1893 | x = np.ones(len(t)) |
| 1894 | |
| 1895 | fig, ax = plt.subplots() |
| 1896 | ax.plot(t, x) |
| 1897 | |
| 1898 | ax.xaxis.set_major_locator(mpl.dates.DayLocator()) |
| 1899 | ax.xaxis.set_major_formatter(mpl.dates.DateFormatter('\n%a')) |
| 1900 | |
| 1901 | ax.xaxis.set_minor_locator(mpl.dates.HourLocator((0, 6, 12, 18))) |
| 1902 | ax.xaxis.set_minor_formatter(mpl.dates.DateFormatter('%H:%M')) |
| 1903 | # force there to be extra ticks |
| 1904 | ax.xaxis.get_minor_ticks(15) |
| 1905 | if remove_overlapping_locs is not None: |
| 1906 | ax.xaxis.remove_overlapping_locs = remove_overlapping_locs |
| 1907 | |
| 1908 | # check that getter/setter exists |
| 1909 | current = ax.xaxis.remove_overlapping_locs |
| 1910 | assert (current == ax.xaxis.get_remove_overlapping_locs()) |
| 1911 | plt.setp(ax.xaxis, remove_overlapping_locs=current) |
| 1912 | new = ax.xaxis.remove_overlapping_locs |
| 1913 | assert (new == ax.xaxis.remove_overlapping_locs) |
| 1914 | |
| 1915 | # check that the accessors filter correctly |
| 1916 | # this is the method that does the actual filtering |
| 1917 | assert len(ax.xaxis.get_minorticklocs()) == expected_num |
| 1918 | # these three are derivative |
| 1919 | assert len(ax.xaxis.get_minor_ticks()) == expected_num |
| 1920 | assert len(ax.xaxis.get_minorticklabels()) == expected_num |
| 1921 | assert len(ax.xaxis.get_minorticklines()) == expected_num*2 |
| 1922 | |
| 1923 | |
| 1924 | @pytest.mark.parametrize('sub', [ |
nothing calls this directly
no test coverage detected
searching dependent graphs…