I want to have a Label for the red y axis avreage line but it wont show up as a label. Also all the Dates from the dataset are all crowdet
This is my Code:
def plot_data(measurement):
df = pd.read_csv("out.csv")
date = df["date"]
value = df[measurement]
plt.plot(date, value, label=host[0:7] + ", " + measurement + ", " + date_til[0:10] + " " + date_from[11:19] + "-" + date_til[11:19])
plt.title(measurement)
plt.xlabel("date")
plt.ylabel(measurement)
plt.legend()
plt.xticks(rotation=45)
average = df[measurement].mean()
plt.axhline(y=average, color='r', linestyle='-', label="average Ø ≈ " + str(average))
fig = plt.gcf()
fig.set_size_inches(18.5, 10.5, forward=True)
#today = date.today()
#print(today)
filename = "plots/plot_" + date_from[0:10] + ".png"
fig.savefig(filename, dpi=100)
print("\rPlot: Done ✔️")



