Add test_axhline in test_datetime.py - #27177
Conversation
There was a problem hiding this comment.
I would say to keep this even more minimal and not have the bar graph (I think setting the ylim is important here)
If anything, I'd just do a ax.plot, but even that I think is not testing what we are looking to test here.
There was a problem hiding this comment.
That sounds good, thank you for the feedback!
scottshambaugh
left a comment
There was a problem hiding this comment.
Could you add subplots to test different combinations of numbers and datetimes on different axes? Similar to the test you added here: #27084
|
@CozyFrog ah I mean having subplots where the X/Y data are different combinations of datetime vs numbers. Right now you have datetimes on the Y axis with numbers on the X axis, and adding the other permutations of that should exercise these codepaths more fully (I think). Your other PR did this well. |
|
@scottshambaugh I don't think that actually makes sense for this method, honestly... the x axis values are in |
|
I'll defer to you on that @ksunden, I'm admittedly not super familiar with how the code paths for the coordinate transforms work work. If it's drawn directly in axes coordinates they I think you're right, my thought was if the xrange was cast to the data coordinates before being drawn. |
|
Thank you for the discussion @scottshambaugh & @ksunden – how should I move forward with this PR? Does this require any modifications? |



PR summary
I have added a datetime (no timedelta; this function does not support it, and I believe that is correct) smoke test for
Axes.axhlineinlib/matplotlib/test/test_datetime.py.This addresses the
Axes.axhlinetask from #26864.The image below is the plot generated from my example code.

PR checklist