8000 Ability to scale axis by a fixed factor by HHest · Pull Request #10321 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Ability to scale axis by a fixed factor #10321

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

Merged
merged 14 commits into from
May 7, 2018
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/matplotlib/axes/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2672,6 +2672,7 @@ def ticklabel_format(self, **kwargs):
be used for numbers outside the range
10`m`:sup: to 10`n`:sup:.
Use (0,0) to include all numbers.
Use (m,m) to fix scaling to 10`m`:sup:.
*useOffset* [ bool | offset ]; if True,
the offset will be calculated as needed;
if False, no offset will be used; if a
Expand Down
5 changes: 4 additions & 1 deletion lib/matplotlib/ticker.py
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,10 @@ def _set_orderOfMagnitude(self, range):
oom = 0
else:
oom = math.floor(math.log10(val))
if oom <= self._powerlimits[0]:
if self._powerlimits[0] == self._powerlimits[1] != 0:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this if statement could go up above to save calculating oom, which we don't end up using in this case...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion. I've moved it higher up.

# fixed scaling when lower power limit = upper <> 0.
self.orderOfMagnitude = self._powerlimits[0]
elif oom <= self._powerlimits[0]:
self.orderOfMagnitude = oom
elif oom >= self._powerlimits[1]:
self.orderOfMagnitude = oom
Expand Down
0