8000 TST: add a test of not removing overlapping locations · matplotlib/matplotlib@964e8cd · GitHub
[go: up one dir, main page]

Skip to content

Commit 964e8cd

Browse files
committed
TST: add a test of not removing overlapping locations
1 parent e3a8393 commit 964e8cd

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

lib/matplotlib/tests/test_ticker.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -923,3 +923,24 @@ def minorticksubplot(xminor, yminor, i):
923923
minorticksubplot(True, False, 2)
924924
minorticksubplot(False, True, 3)
925925
minorticksubplot(True, True, 4)
926+
927+
928+
def test_remove_overlap():
929+
import numpy as np
930+
import matplotlib.dates as mdates
931+
932+
t = np.arange("2018-11-03", "2018-11-06", dtype="datetime64")
933+
x = np.ones(len(t))
934+
935+
fig, ax = plt.subplots()
936+
ax.plot(t, x)
937+
938+
ax.xaxis.set_major_locator(mdates.DayLocator())
939+
ax.xaxis.set_major_formatter(mdates.DateFormatter('\n%a'))
940+
941+
ax.xaxis.set_minor_locator(mdates.HourLocator((0, 6, 12, 18)))
942+
ax.xaxis.set_minor_formatter(mdates.DateFormatter('%H:%M'))
943+
944+
assert len(ax.xaxis.get_minorticklocs()) == 6
945+
ax.xaxis.remove_overlapping_locs = False
946+
assert len(ax.xaxis.get_minorticklocs()) == 9

0 commit comments

Comments
 (0)
0