Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Proposed change to default log scale tick formatting #5161

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 9 commits into from
Aug 22, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix numdec computation for symlog axes
  • Loading branch information
zblz committed Aug 3, 2016
commit ad0a7518701fd41aa4eb7258c6307f3cace9a66a
2 changes: 1 addition & 1 deletion 2 lib/matplotlib/scale.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ def set_default_locators_and_formatters(self, axis):
axis.set_major_formatter(LogFormatterSciNotation(self.base))
axis.set_minor_locator(SymmetricalLogLocator(self.get_transform(),
self.subs))
axis.set_minor_formatter(LogFormatterSciNotation(self.base))
axis.set_minor_formatter(NullFormatter())

def get_transform(self):
"""
Expand Down
20 changes: 17 additions & 3 deletions 20 lib/matplotlib/ticker.py
Original file line number Diff line number Diff line change
Expand Up @@ -845,10 +845,24 @@ def set_locs(self, locs):

vmin, vmax = self.axis.get_view_interval()
self.d = abs(vmax - vmin)
vmin = math.log(vmin) / math.log(b)
vmax = math.log(vmax) / math.log(b)

numdec = abs(vmax - vmin)
if hasattr(self.axis.get_transform(), 'linthresh'):
t = self.axis.get_transform()
linthresh = t.linthresh
# Only compute the number of decades in the logarithmic part of the
# axis
numdec = 0
if vmin < -linthresh:
numdec += math.log(-vmin / linthresh) / math.log(b)

if vmax > linthresh and vmin < linthresh:
numdec += math.log(vmax / linthresh) / math.log(b)
elif vmin >= linthresh:
numdec += math.log(vmax / vmin) / math.log(b)
else:
vmin = math.log(vmin) / math.log(b)
vmax = math.log(vmax) / math.log(b)
numdec = abs(vmax - vmin)

if numdec > 3:
# Label only bases
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.