-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Autoscaling on log axis with negative data results in arbitrary limits. #10782
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
What happens if you set the scale before calling scatter? Loglog etc check for negative I think |
Good point, but setting the scale before the plotting does not make any difference, i.e.
results in the same plot as above. |
I think this might be a duplicate of #7733 EDIT it isn't. |
@dstansby Not sure; the other post seems to give the correct result (0 not being in the plot, but the axis limits are correct and the plot shows all points.). Setting bottom=0 may not make much sense for a log axis, so the warning is expected? Here, we have no warning and limits are just arbitrarily shifted. |
I still slightly suspect that they might have a common cause, but I'm not sure. I'll try and dig into this one to see what's happening. |
This issue has been marked "inactive" because it has been 365 days since the last comment. If this issue is still present in recent Matplotlib releases, or the feature request is still wanted, please leave a comment and this label will be removed. If there are no updates in another 30 days, this issue will be automatically closed, but you are free to re-open or create a new issue if needed. We value issue reports, and this procedure is meant to help us resurface and prioritize issues that have not been addressed yet, not make them disappear. Thanks for your help! |
This was fixed by #18642. |
Bug report
Bug summary
Plotting negative values on a log scale is possible. However it changes the axis limits in a seemingly arbitrary way.
Code for reproduction
The following shows three scatter plots. The
x
values(1) are all positive
(2) contain one negative value
(3) have the negative value filtered out
Actual outcome
The second subplot, where the data contains a negative value, shows only part of the valid data, because the axis is autoscaled to some seemingly arbitrary region.
Expected outcome
The third subplot would be the expected outcome with the axis autoscaled to show all points.
One could also argue that plotting negative data on a log scale should not be supported at all, and that it should be the user's responsibility to make sure the data is positive. In that case however it would make sense to issue a warning instead of just plotting something arbitrary.
Matplotlib version
The text was updated successfully, but these errors were encountered: