0

The following python code produces a figure with a very odd axis offset. Is this a bug or intended behavior?

I'm using Python 2.7 and Matplotlib 1.3.1

import matplotlib.pyplot as plt
plt.plot([680e-3-20.0, 720e-3-20.0])

The Y-Axis range is -0.04 to 0 with an offset of -1.928e1. I would expect the offset to be present in the axis labeling.

Unfortunately I can not post the plot image due to a lack of "reputations"

Looking forward for your comments.

Nalaka526
  • 11,278
  • 21
  • 82
  • 116

1 Answers1

0

It looks like normal behavior to me, if you dont want an offset you can disable it with:

fig, ax = plt.subplots()

ax.plot([680e-3 - 20.0, 720e-3 - 20.0])

ax.yaxis.set_major_formatter(mpl.ticker.ScalarFormatter(useOffset=False))

enter image description here

You can also set the offset yourself with:

mpl.ticker.ScalarFormatter(useOffset=-20)
Rutger Kassies
  • 61,630
  • 17
  • 112
  • 97