I'm looking for some advice about how to achieve the wanted result.
Basically I have columns in my df that are measures of the same variable for different categories, like this:
TIME | var_X_group_A | var_X_group_B | var_Y_group_A | var_Y_group_B
18:00 | 120 | 330 | 11 | 12
19:00 | 110 | 230 | 8 | 18
20:00 | ... | ... | ... | ...
I'm plotting them with matplotlib using the following code:
df.plot(x = "TIME", y=["var_X_group_A", "var_X_group_B"], figsize=(15, 5), title = "var X")
ax = plt.axes()
ax.yaxis.set_label_text('var X')
ax.yaxis.grid(True)
df.plot(x = "TIME", y=["var_Y_group_A", "var_Y_group_B"], figsize=(15, 5), title = "var Y")
ax = plt.axes()
ax.yaxis.set_label_text('var Y')
ax.yaxis.grid(True)
I'm having some hard times structuring these two plots in a single figure with subplot and save such figure as .pdf
Moreover I would also like to add a 'trend line' at the average value, with a little label displaying the average value.
Thank you for all the support