Skip to content


Subversion checkout URL

You can clone with
Download ZIP


ScalarFormatter creates useless offsets by default #461

jalan opened this Issue · 8 comments

6 participants


Here is a minimal example of this issue in action. Take a look at the offsets we get by default:


import matplotlib.pyplot

# Sample data
x = [1, 2, 3, 4]
y1 = [1119, 1125, 1122, 1118]
y2 = [0.002101, 0.002104, 0.002103, 0.002102]

# Plot the data
figure_1 = matplotlib.pyplot.figure()
axes_1 = figure_1.add_subplot(211) 
axes_1.plot(x, y1)
axes_2 = figure_1.add_subplot(212)
axes_2.plot(x, y2)

# View

These offsets are less than helpful. For now I just constantly use


Agreed, I have never quite liked the offset chosen by the formatter. A while back, I attempted to come up with an algorithm that tried to determine the common significant digits of a set of values, but there were several cases where it failed to do what was desired. Maybe I should look at that code again and see if I could get it working.


Perhaps this feature should be off by default, at least until the algorithm is improved? I admit it could be useful occasionally, but right now it can produce some rather surprising results!


Another problem: a y-axis offset showed up by default again, but this time I am using the DateFormatter. No problem, I'll turn it off as usual:

axes_1 = figure_1.add_subplot(111)
axes_1.plot_date(x, y, xdate=True)
AttributeError: This method only works with the ScalarFormatter.

Can't turn it off! But it we put the commands in another order, can we trick it into giving us what we want?:

axes_1 = figure_1.add_subplot(111)
axes_1.plot_date(x, y, xdate=True)

No error, and I get what I want!


I've been looking into this a little bit. It doesn't matter how many common significant figures there are, if the number of them gets much bigger than, say, two the offset becomes unreadable.

How about always using an offset in normalised notation?


useOffset should be set to False by default.



I recently stumbled over this issue, it took me quite some time to figure out what was wrong with my plots, because I didn't interpret my axis correctly. I find this behavior very confusing. The fact that everyone in this issue seems to agree, yet no patch has been presented is a bit weird.


Closing because #2401 which provides an rcParam for the value of useoffset has been merged

@tacaswell tacaswell closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.