Thanks to visit codestin.com
Credit goes to github.com

Skip to content

set_useOffset(False) is not working #16232

Closed
@vallsv

Description

@vallsv

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

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