I'm trying to make a code for a pandemic simulation. I have a csv file with data from 3 groups: S (Susceptible) – I (Infectious) – R (Recovered) – . I want to plot all three lists (s, i, r) in the same 2d plot. So that we can see three graphs in the same plot. Where the x axis is days and the y axis is in percentage (eg from 0 to 1). I have problem with making these plots, Here is my code:
import numpy as np
import matplotlib.pyplot as plt
s = []
i = []
r = []
with open("pan.csv","r") as f:
lis = [line.split(",") for line in f]
for n in range(1,121):
s.append(int(lis[n][0]))
i.append(float(lis[n][1]))
r.append(float(lis[n][2]))
n_list= [s, i, r]
fig = plt.figure()
ax = fig.add_subplot()
w = [s, i, r]
w_np = np.array(w)
# ax.plot(s, range(1)) here I have the problem
plt.show()
anyone can help me for plotting?
Trying to plot three 2d plots (x from three lists and y between 0-1 in percentage) in same plot.
import pandas as pd,df = pd.read_csv('pan.csv'), andax = df.plot(figsize=(6, 6))