Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Offset is empty with usetex when offset is equal to 1 #1615

Merged
merged 1 commit into from

3 participants

@antoinehu

Example:

from pylab import *
rc('text',usetex=True)
t=arange(1,1+1e-6,1e-7)
f = lambda x: 1e6*(x-1)
plot(t,vectorize(f)(t))
show()

Missing offset

The problem arises in ScalarFormatter._formatSciNotation; a solution could be replacing

if significand == '1':

with

if significand == '1' and not exponent == '':
@mdboom
Owner

Seems like a bonafide bug and a reasonable fix, but I'd like to give others a chance to comment as well.

@dmcdougall
Collaborator

Yeah, I agree.

@antoinehu Would you be able to create a pull request against the v1.2.x branch?

@mdboom mdboom referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@mdboom mdboom merged commit ccd48cb into from
@mdboom mdboom deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 11, 2013
  1. @mdboom

    Fix #1615 -- offset is empty.

    mdboom authored
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  lib/matplotlib/ticker.py
View
2  lib/matplotlib/ticker.py
@@ -581,7 +581,7 @@ def _formatSciNotation(self, s):
sign = tup[1][0].replace(positive_sign, '')
exponent = tup[1][1:].lstrip('0')
if self._useMathText or self._usetex:
- if significand == '1':
+ if significand == '1' and exponent != '':
# reformat 1x10^y as 10^y
significand = ''
if exponent:
Something went wrong with that request. Please try again.