The chart is incorrect for a specific number (19.607843137254918). I am not creating this number manually. Instead I get it from a pandas data frame. I have no control over what data I get so I am not sure about what is special about this number that causes a wrong chart.
Please look at the
Please see the Y-Axis of the attached image to see what is wrong. I expect a plot with Y-values around 19. But instead the plot shows 5.5 with a scale that is 1e-11+...
The plot is correct, even if it isn't totally clear. The offset is about
+1.96078e1, which is 19.6078. And the 5.5 in the y-axis is multiplied by
1e-11, which is a really small number for the very small changes that your
data has relative to its very large offset.
On Mon, May 16, 2022 at 1:39 PM Manish Bajpai ***@***.***> wrote:
Bug summary
The chart is incorrect for a specific number (19.607843137254918). I am
not creating this number manually. Instead I get it from a pandas data
frame. I have no control over what data I get so I am not sure about what
is special about this number that causes a wrong chart.
Please look at the
Code for reproduction
from matplotlib.pyplot import figureimport matplotlib.pyplot as plt
figure(figsize=(8, 6), dpi=100)plt.plot([19.607843137254903, 19.607843137254903, 19.607843137254903, 19.607843137254903, 19.607843137254903, 19.60784313725489, 19.607843137254918])plt.show()
Actual outcome
[image: plot]
<https://user-images.githubusercontent.com/10093538/168650450-bf24860f-611f-4d54-8c2e-6aebaba78de1.PNG>
Expected outcome
Please see the Y-Axis of the attached image to see what is wrong. I expect
a plot with Y-values around 19. But instead the plot shows 5.5 with a scale
that is 1e-11+...
Additional information
*No response*
Operating system
OS/X
Matplotlib Version
3.5.1
Matplotlib Backend
*No response*
Python version
Python 3.9.10
Jupyter version
*No response*
Installation
pip
—
Reply to this email directly, view it on GitHub
<#23053>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACHF6E4DENIAG5XELC6ST3VKKB3JANCNFSM5WCHMHFQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
Yeah I do wonder if we could make this more straightforward. By the time we are four classes down the tree we have made a feature really hard to discover.
IMHO we should deactivate this by default. It's useful only if you know that this exists and how it works. If the users really want it they can activate it, otherwise it's just confusing.
fwiw I have it deactivated in my default matplotlibrc and am always slightly confused when running my code on some other computer that doesn't have it ("ah, I need to unset that explicitly").
It is my suspicion that defaulting to false will cause approximately the same number of bug reports (in addition to a wave of "this used to work!" bug reports), but am not sure so I'm neutral on this change.
Activity
WeatherGod commented on May 16, 2022
jklymak commented on May 16, 2022
You can turn this behaviour off with something like ax.get_yaxis().get_major_formatter().set_useOffset(False)
timhoffm commented on May 16, 2022
See also https://matplotlib.org/devdocs/users/faq/howto_faq.html#prevent-ticklabels-from-having-an-offset.
jklymak commented on May 16, 2022
Yeah I do wonder if we could make this more straightforward. By the time we are four classes down the tree we have made a feature really hard to discover.
tacaswell commented on May 16, 2022
We should move the rcparam version of that higher up and give it a code example.
timhoffm commented on May 16, 2022
IMHO we should deactivate this by default. It's useful only if you know that this exists and how it works. If the users really want it they can activate it, otherwise it's just confusing.
anntzer commented on May 16, 2022
fwiw I have it deactivated in my default matplotlibrc and am always slightly confused when running my code on some other computer that doesn't have it ("ah, I need to unset that explicitly").
jklymak commented on May 17, 2022
I'd be good with deactivating.
I think we could add ax.x/yaxis.set_use_offset to control this on a per-axis basis.
tacaswell commented on May 17, 2022
It is my suspicion that defaulting to false will cause approximately the same number of bug reports (in addition to a wave of "this used to work!" bug reports), but am not sure so I'm neutral on this change.