Home > Net >  Matplotlib - Y axis change my values automatically
Matplotlib - Y axis change my values automatically

Time:10-14

I'm building a python application to keep track of the BTC values over time through a graph that updates in realtime; in the x axis there is time and in the y axis the value of the corresponding BTC. my problem is that at the beginning the BTC values in the y axis are correct as in the first figure, but after some data received, the graph decides to "zoom" and express all the data in a different notation, as in the second figure (open imgur link).

https://imgur.com/a/spogs9G

I tried these two lines of code but without success:

plt.autoscale(enable=False, axis='y')

ax.get_yaxis().get_major_formatter().set_scientific(False)

If it can help, i am using:

import matplotlib.pyplot as plt
import matplotlib.animation as animation

If you would like to see all or part of the code, please ask.

Thank you in advance.

CodePudding user response:

Fix the y-axis by using (as an example):

ax.set_ylim(0,1000)

and define the lower and upper bound accordign to your problem. ax.set_ylim(lower_bound,upper_bound)

  • Related