Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Add test_quiver in test_datetime.py#27407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
It seems likey
could also be tested? I'm not sure if it also makes sense to tryu
andv
as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I don't really follow the assertion thaty
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I agree that y is not actually different from x here and should be tested, additionally Ido think u/v should be tested withangles="xy"
and u/v supplied astimedelta
s. I think passing u/v as timedeltas shouldnot be included with the (default)angles="uv"
Uh oh!
There was an error while loading.Please reload this page.
Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
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