Home > Back-end >  How to avoid matplotlib to simplify my Y axis in figure?
How to avoid matplotlib to simplify my Y axis in figure?

Time:12-22

the image of what I mean in my question

1

I'm using BMP280 to measure Temperature and Pressure using Raspberry.

I'm using matplotlib to make a graph, but the matplotlib simplify my Y axis bi adding 9.967e2.

is there any way to avoid matplotlib simplify my Y axis. Sorry I'm new to this so I don't know much.

I tried to search in google but I don't find anything. Maybe I'm using the wrong keyword as I don't know what should I search.

CodePudding user response:

You can turn off the offset as shown in the examples here. For example, if you've made you plot with:

from matplotlib import pyplot as plt

plt.plot(x, y)

then you can turn off the offset with

ax = plt.gca()  # get the axes object

# turn off the offset (on the y-axis only)
ax.ticklabel_format(axis="y", useOffset=False)

plt.show()

See the ticklabel_format docs for more info.

  • Related