()
| 1310 | |
| 1311 | |
| 1312 | def test_set_offset_units(): |
| 1313 | # passing the offsets in initially (i.e. via scatter) |
| 1314 | # should yield the same results as `set_offsets` |
| 1315 | x = np.linspace(0, 10, 5) |
| 1316 | y = np.sin(x) |
| 1317 | d = x * np.timedelta64(24, 'h') + np.datetime64('2021-11-29') |
| 1318 | |
| 1319 | sc = plt.scatter(d, y) |
| 1320 | off0 = sc.get_offsets() |
| 1321 | sc.set_offsets(list(zip(d, y))) |
| 1322 | np.testing.assert_allclose(off0, sc.get_offsets()) |
| 1323 | |
| 1324 | # try the other way around |
| 1325 | fig, ax = plt.subplots() |
| 1326 | sc = ax.scatter(y, d) |
| 1327 | off0 = sc.get_offsets() |
| 1328 | sc.set_offsets(list(zip(y, d))) |
| 1329 | np.testing.assert_allclose(off0, sc.get_offsets()) |
| 1330 | |
| 1331 | |
| 1332 | @image_comparison(["test_check_masked_offsets.png"], remove_text=True, style="mpl20") |
nothing calls this directly
no test coverage detected
searching dependent graphs…