1

I am trying to set a maximum value for the y axis in my graph. On matplotlib.org I am reading about how the axis can be set with:

plt.axis([0, 6, 0, 20])

[xmin, xmax, ymin, ymax]

But my script is using time series data in the X axis.. Would I need to account for unix time min & maximum?

This is the code I am using, and I am just trying to limit the Y axis from 0 to 100, but keep the time stamp X axis the same... Also see below for plt for what I am trying to explain, thank you

import pandas as pd
import matplotlib.pyplot as plt
import numpy as np

df = pd.read_csv('C:\\Trend Data\\Econ py\\data CSV.csv', index_col='Date', parse_dates=True)
#print(df)

OAT = pd.Series(df[df.columns[0]])

RAT = pd.Series(df[df.columns[1]])

MAT = pd.Series(df[df.columns[2]])


df_math = pd.DataFrame({'mat' : MAT,
                   'rat' : RAT,
                   'oat' : OAT})

df_math['OSAcalc'] = ((df_math['mat'] - df_math['rat']) / (df_math['oat'] -     df_math['rat']))*100


plt.plot(df_math['OSAcalc'])
plt.title("Percent Fresh Air")
#plt.axis([0, 100, 0, 100])
plt.show()

#df_math.boxplot(['mat', 'rat', 'oat'])
#plt.show()

enter image description here

bbartling
  • 3,288
  • 9
  • 43
  • 88

0 Answers0