Skip to content

Fixed logformatting for non integer bases. #960

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 2 commits into from
Aug 3, 2012
Merged
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
Review action.
  • Loading branch information
pelson committed Jul 28, 2012
commit b8dde0193a6c0bc9e78a4799b49f8c729ccc0caa
18 changes: 9 additions & 9 deletions lib/matplotlib/ticker.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,24 +696,24 @@ def __call__(self, x, pos=None):
if b % 1 == 0.0:
base = '%d' % b
else:
base = '%s' % b
base = '%s' % b

if not is_decade and self.labelOnlyBase:
return ''
elif not is_decade:
if usetex:
return (r'$%s' + base + r'^{%.2f}$') % \
(sign_string, fx)
return (r'$%s%s^{%.2f}$') % \
(sign_string, base, fx)
else:
return ('$\mathdefault{%s' + base + '^{%.2f}}$') % \
(sign_string, fx)
return ('$\mathdefault{%s%s^{%.2f}}$') % \
(sign_string, base, fx)
else:
if usetex:
return (r'$%s' + base + r'^{%d}$') % \
(sign_string, nearest_long(fx))
return (r'$%s%s^{%d}$') % \
(sign_string, base, nearest_long(fx))
else:
return (r'$\mathdefault{%s' + base + r'^{%d}}$') % \
(sign_string, nearest_long(fx))
return (r'$\mathdefault{%s%s^{%d}}$') % \
(sign_string, base, nearest_long(fx))


class EngFormatter(Formatter):
Expand Down