-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[Bug]: axes vlines() / hlines() incorrectly use data coordinate as min when blended transform is applied #23171
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Labeling this as a good first issue because there is no API design and this appears to be a clearly identified bug that should be fixed. Labeling as medium difficulty as this is probably not a project someone new to Python should take on. |
I suspect the problem lies with the scaling done at the end of matplotlib/lib/matplotlib/axes/_axes.py Lines 1142 to 1149 in 9765379
In the example scenario, the In contrast, |
Is anyone currently working on this issue? I have not done any open source contribution before and would be interested in giving it a stab as a first issue. |
I don't think anyone is working on this; feel free to take a stab at it. |
Hi, I'm new to open source and wanted to take a look at this issue. |
Forgive me if I'm misinterpreting your question, but the issue is that this function supports multiple coordinate systems and the original poster is trying to plot the vlines in the axes coordinate system. The axes coordinates are independent of the data coordinates and are fixed to the displayed axes:
In the expected image provided by the original poster, 0 in axes coordinates is the bottom of the displayed axes, which is supposed to be more or less at the same place as the data 9. The bug is that instead of plotting the bottom of the line in axes coordinates (so at around data 9), it is plotting the line at 0 in data coordinates, which in turn is changing the axes to produce the incorrect example. |
Thank you for the explanation, I understand now. I'll look into it more. |
Bug summary
For
Axes.vlines()
, when I want to use axes coordinate forymin
/ymax
, as suggested in blended transformation,ymin
is incorrectly treated as data coordinate.Axes.hlines()
has a similar problem withxmin
.Code for reproduction
Actual outcome
One can see that while
ymax
is applied correctly (about 15% of the y-axis),ymin
is applied incorrectly.ymin
is treated as data coordinate, incorrectly stretching the y-axis.Expected outcome
The expected outcome can be obtained using multiple
axvline()
instead ofvlines()
:Additional information
I've encountered the problem in earlier versions. I cannot recall it ever works correctly.
Axes.hlines()
has a similar problem withxmin
.One can add the following to the example codes above to test it:
Operating system
Windows
Matplotlib Version
3.5.2
Matplotlib Backend
module://matplotlib_inline.backend_inline
Python version
Python 3.9.10
Jupyter version
6.4.11
Installation
conda
The text was updated successfully, but these errors were encountered: