'Axes messed up trying to plot temporal series with matplotlib
I've got an issue when trying to two temporal series with Matplotlib. The temporal series should share the same y-axis/scale since it's supposed to be a comparison on modeled and mesured values.
However, when plotting, it seems that the y and x scales are getting messed-up :
here is the code associated
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import datetime as dt
#import des données
Data=pd.read_csv('Filepath/Recept_41R001.csv', sep=';')
Data['Date']=pd.to_datetime(Data['Date'])
Data.sort_values(by='Date')
Data.set_index('Date', inplace=True)
Data01=Data['2018-01-01 00:00:00':'2018-01-31 23:00:00']
fig, ax=plt.subplots()
ax.plot(recept0101.index, recept0101['NO2_Mod'])
ax.plot(recept0101.index, recept0101['NO2_Mes'])
ax.set_xlabel('Time')
ax.set_ylabel('NO2 µg/m3')
ax.set_title('NO2 Modeled vs Mesured 01-2018')
ax.legend(['Modeled NO2','Mesured NO2'])
plt.show()
-I've checked my data for the problematic time indexes and nothing seems to indicate a problem related to the data -the issue is the same regardless of the month I try to plot -even excel recognise the data as float -the issue is still there when I try to set_ylim -I ran the code on IDLE(Python 3.9) and Visual Studio Code.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
