Add test_quiver in test_datetime.py#27407
Conversation
| u = np.sin(np.arange(len(x))) | ||
| v = np.cos(np.arange(len(x))) | ||
| fig, ax = plt.subplots(figsize=(10, 6)) | ||
| ax.quiver(x, y, u, v, scale=20) |
There was a problem hiding this comment.
It seems like y could also be tested? I'm not sure if it also makes sense to try u and v as well.
There was a problem hiding this comment.
Quiver plots typically expect numerical values for u and v (representing vector components), and y is usually a numerical position value. Using datetime objects for these variables would be unconventional and might not work directly with the quiver plot functionality. I think it might be better to maintain the test as is.
There was a problem hiding this comment.
I don't really follow the assertion that y is usually a numerical position value. But in any case, these tests are to check whether the code works, not what the "usual" type is. We absolutely want to test things that are unusual.
There was a problem hiding this comment.
I agree that y is not actually different from x here and should be tested, additionally I do think u/v should be tested with angles="xy" and u/v supplied as timedeltas. I think passing u/v as timedeltas should not be included with the (default) angles="uv"
Co-authored-by: Elliott Sales de Andrade <[email protected]>
PR summary
I have added a datetime smoke test for Axes.quiver in lib/matplotlib/test/test_datetime.py.
This addresses the Axes.quiver task from #26864.
The image below is the plot generated from my example code.

PR checklist