I got these 2 simple csv data but when plotting the 'mon' line gone strange toward the end. When plotting one chart, it is fine but when the 2 charts plotted together the 'monarch' one goes strange.
Thanks in advance.
Here is the code
import pandas as pd
from matplotlib import pyplot as plt
def run_plot1():
df_ash = pd.read_csv('./data/ashburn.csv')
df_mon = pd.read_csv('./data/monarch1bed.csv')
plt.grid(True)
plt.plot(df_ash['Date'], df_ash['Ash1bed'], label='Ashburn 1 bed')
plt.plot(df_mon['Date'], df_mon['Mon1bed'], label='Monarch 1 bed')
plt.xlabel("Date")
plt.ylabel("Rate")
plt.style.use("fivethirtyeight")
plt.title("One Bed Comparison")
plt.legend()
plt.savefig('data/sample.png')
plt.tight_layout()
plt.show()
run_plot1()
and the csv datas:
Date,Ash1bed,Ash2bed,Ash3bed
08-01,306,402
22-01,181,286,349
05-02,176,281,336
19-02,188,293,369
04-03,201,306,402
18-03,209
01-04,217,394,492
15-04,209,354,455
29-04,197,302,387
13-05,205,326,414
27-05,217,362,473
10-06,390,532
08-07,415
22-07,415
05-08,415
19-08,415
15-09,290,452,594
and another :
Date,Mon1bed
08-01,230
05-02,160
19-02,160
04-03,190
18-03,190
01-04,260
15-04,260
29-04,260
13-05,300
27-05,330
10-06,330
24-06,350
08-07,350
22-07,350
05-08,350
19-08,350
02-09,350


Datein the formatYYYY-MM-DDand convert it to datetime you should have a nice plot.