MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / test_axhline

Function test_axhline

lib/matplotlib/tests/test_dates.py:123–140  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

121
122
123def test_axhline():
124 # make sure that axhline doesn't set the xlimits...
125 fig, ax = plt.subplots()
126 ax.axhline(1.5)
127 ax.plot([np.datetime64('2016-01-01'), np.datetime64('2016-01-02')], [1, 2])
128 np.testing.assert_allclose(ax.get_xlim(),
129 [mdates.date2num(np.datetime64('2016-01-01')),
130 mdates.date2num(np.datetime64('2016-01-02'))])
131
132 mdates._reset_epoch_test_example()
133 mdates.set_epoch('0000-12-31')
134 fig, ax = plt.subplots()
135 ax.axhline(1.5)
136 ax.plot([np.datetime64('2016-01-01'), np.datetime64('2016-01-02')], [1, 2])
137 np.testing.assert_allclose(ax.get_xlim(),
138 [mdates.date2num(np.datetime64('2016-01-01')),
139 mdates.date2num(np.datetime64('2016-01-02'))])
140 mdates._reset_epoch_test_example()
141
142
143@image_comparison(['date_axhspan.png'], style='mpl20')

Callers

nothing calls this directly

Calls 4

axhlineMethod · 0.80
subplotsMethod · 0.45
plotMethod · 0.45
get_xlimMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…