Skip to content

set_useOffset(False) is not working #16232

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

Closed
vallsv opened this issue Jan 15, 2020 · 5 comments
Closed

set_useOffset(False) is not working #16232

vallsv opened this issue Jan 15, 2020 · 5 comments
Labels
Community support Users in need of help.

Comments

@vallsv
Copy link
Contributor

vallsv commented Jan 15, 2020

Hi,

I try to disable the offset computed to label the axes in the plot.

It looks like the global or local set of useOffset is just ignored.

Code for reproduction

import matplotlib
import matplotlib.pyplot as plt
from mpl_toolkits.axisartist.axislines import Subplot

# Disable it globally
matplotlib.rcParams["axes.formatter.useoffset"] = False

fig = plt.figure(figsize=(3, 3))

ax = Subplot(fig, 111)
fig.add_subplot(ax)

ax.axis["right"].set_visible(False)
ax.axis["top"].set_visible(False)

# Disable it locally
ax.get_yaxis().get_major_formatter().set_useOffset(False)

ax.set_ylim(10 ** 8, 10 ** 8 + 1)

print(ax.get_yaxis().get_major_formatter().useOffset)
# > False

plt.show()

Actual outcome

Screenshot from 2020-01-15 17-21-52

Expected outcome

We should not see the 1e8 and the axis should be labelled without the remove of the offset.

Matplotlib version

  • matplotlib 3.1.1
@anntzer
Copy link
Contributor

anntzer commented Jan 15, 2020

That's not the offset (which refers to an added offset, not a multiplicative factor). You can turn off the factor with set_scientific(False).

@anntzer anntzer added the Community support Users in need of help. label Jan 15, 2020
@vallsv
Copy link
Contributor Author

vallsv commented Jan 16, 2020

Thanks a lot.

It works, but it really sounds weird.

Cause I don't want to disable scientific notation for numbers in the axis, which could be used without problem. I don't want to have a splinting of the values in 2 which is exactly what is supposed to be done by useOffset.

Do you think there is a problem in the method naming? or the documentation?

@anntzer
Copy link
Contributor

anntzer commented Jan 16, 2020

The name is unlikely to change, but you are welcome to propose improvements to the docs.

@timhoffm
Copy link
Member

timhoffm commented Jun 9, 2020

The above example does not show offset, but the scientific notation:

with useOffset
grafik

without useOffset (falling back to scientific) in case of the given numbers
grafik

Only if you disable both offset and scientific notation will you get the complete numbers at the labels for the data provided in the example.
grafik

The offset and the scientific label are quite similar, but offsets have a +/- sign while the scientific scaling factor has not.

@vallsv
Copy link
Contributor Author

vallsv commented Jun 9, 2020

Then everything is working as expected.

But maybe an example with normal values on axis, and maybe your screenshot in the documentation could be really useful for other people.

Thanks a lot, i close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community support Users in need of help.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants