FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

set_useOffset(False) is not working · Issue #16232 · matplotlib/matplotlib · GitHub

Repository navigation

set_useOffset(False) is not working #16232

Closed

Description

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

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

Activity

  1. anntzer commented on Jan 15, 2020

    Contributor

    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).

  2. vallsv commented on Jan 16, 2020

    ContributorAuthor

    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?

  3. anntzer commented on Jan 16, 2020

    Contributor

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

  4. timhoffm commented on Jun 9, 2020

    Member

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

    with useOffset

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

    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.

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

  5. vallsv commented on Jun 9, 2020

    ContributorAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL