When I create a graph in Matplotlib it jumps from 19 to 100 in one go.
I have this data file:
{
"temps": [
"19.8498",
"19.8377",
"19.8352",
"19.84",
"19.8377",
"19.8328",
"19.8449",
"19.8352"
],
"pressure": [
"98.815",
"98.824",
"98.805",
"98.786",
"98.795",
"98.79",
"98.818",
"98.806"
]
}
and this code reading it and creating a graph:
import json
import matplotlib.pyplot as plt
import numpy as np
dataFile = json.load(open("Data.json", "r"))
temps = dataFile["temps"]
pressures = dataFile["pressure"]
time = np.arange(len(temps))
figure = plt.figure()
ax = figure.add_subplot(111)
ax.plot(time, temps)
ax.plot(time, pressures)
plt.show()
However when I plot this the scale ends up wrong and looks like this:
]
How can I stop it jumping from 19 to 100 on the graph? I have tried using ylim(start,end) but that pushes every value down to almost 0
Thanks