plt.plot(np.diff(cases), linewidth=3.0) plt.scatter(shelter_in_place, np.diff(cases)[shelter_in_place], color="orange", s=64) plt.legend(["Cases per day", "Shelter-in-place order"]) plt.title("Cases per day") plt.xlabel("Days since first case") plt.ylabel("Cases") x1, x2, y1, y2 = plt.axis() plt.axis((x1, x2, 0, my)) plt.savefig("harris_raw.svg") plt.close() ys = smooth.epi_smooth_dx(np.diff(cases)) plt.plot(ys, linewidth=3) plt.scatter(shelter_in_place, ys[shelter_in_place], color="orange", s=64) plt.legend(["Cases per day", "Shelter-in-place order"]) plt.title("Cases per day") plt.xlabel("Days since first case") plt.ylabel("Cases") x1, x2, y1, y2 = plt.axis() plt.axis((x1, x2, 0, my)) plt.savefig("harris_smoothed.svg") plt.close() ys = smooth.moving_average(np.diff(cases)) plt.plot(ys, linewidth=3) plt.scatter(shelter_in_place, ys[shelter_in_place], color="orange", s=64)
import numpy as np import pandas as pd import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as plt import smooth df=pd.read_csv("manually_tabulated_dallas_testing.csv",header=4) df.set_index("date") tests=df["tests"].values cases=df["positives"].values plt.plot(smooth.epi_smooth_dx(cases/tests),linewidth=4,color="orange") plt.bar(range(0,len(cases)),cases/tests) plt.title("Ratio of positive tests") plt.ylabel("Positive ratio") plt.xlabel("day") plt.legend(["Trend","Raw data"]) plt.savefig("positive_ratio.svg") plt.close() plt.plot(smooth.epi_smooth_dx(cases),linewidth=4,color="orange") plt.bar(range(0,len(cases)),cases) plt.title("Cases per day") plt.ylabel("cases") plt.xlabel("day") plt.legend(["Trend","Raw data"]) plt.savefig("cases_per_day.svg")