Skip to content
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

autoscaling of yaxis fails #7259

Closed
lvankampenhout opened this issue Oct 12, 2016 · 4 comments
Closed

autoscaling of yaxis fails #7259

lvankampenhout opened this issue Oct 12, 2016 · 4 comments

Comments

@lvankampenhout
Copy link

lvankampenhout commented Oct 12, 2016

I have a model dataset that has a maximum value of (approx.) 10,000 or 1e4.
When I plot this with MPL some of the timeseries come out with a wrong axis. As you can see in the attached figure, the maximum appears to be 2.0e4.
One timeseries exhibits the value 7.0e3 (shown in Figure, not example).

Minimal example attached (needs text files).

MPL version 1.5.3, Python 3.5.2, both installed from anaconda
Mac OSX 10.11.6

y0.txt
y1.txt
y2.txt
y3.txt
y4.txt
y5.txt
y6.txt
y7.txt
y8.txt
y9.txt

example.py.txt

screen shot 2016-10-12 at 15 20 59

@afvincent
Copy link
Contributor

It looks like the offset label is an additive one in the case of your screenshot (and should thus be read like 'tick_value = tick_label + 999x'), or am I wrong?

@lvankampenhout
Copy link
Author

Whoops, I didn't know additive offsets existed, I interpreted this as a multiplicative one. Inserting

y_formatter = matplotlib.ticker.ScalarFormatter(useOffset=False)
ax.yaxis.set_major_formatter(y_formatter)

found here
fixed the issue ! Please close

@lvankampenhout
Copy link
Author

Thanks afvincent

@afvincent
Copy link
Contributor

You're welcome.

If you want to know more about tick locators and formatters, here is some doc:
http://matplotlib.org/api/ticker_api.html.

Some nice examples are available in the development gallery (and should be shipped with matplotlib v2):
http://matplotlib.org/devdocs/examples/ticks_and_spines/tick-locators.html
http://matplotlib.org/devdocs/examples/ticks_and_spines/tick-formatters.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants