| 121 | |
| 122 | |
| 123 | def 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') |