My goal is to create a time series plot for each column in my data with their corresponding rolling mean. I'd like the color of the lines across subplots to be different. For example, for gym and rolling_mean_gym in the second subplot, the color of the lines should be purple and red. How do I do this?
When I set the color option inside plot(), it changes the color of both the raw data plot and the rolling mean plot, which is not ideal.
I created the plot below by calculating the rolling mean of each column of the time series using the following code:
# calculate rolling mean
def rolling_mean(col):rolling_mean_col = 'rolling_mean_{}'.format(col)df[rolling_mean_col] = df[col].rolling(12).mean()# create rolling mean columns
cols = ['diet', 'gym', 'finance']
for col in cols:rolling_mean(col)# plot data in subplots
fig, axes = plt.subplots(nrows=3, ncols=1, figsize=(13,10));
df[['diet', 'rolling_mean_diet']].plot(ax=axes[0]);
df[['gym', 'rolling_mean_gym']].plot(ax=axes[1]);
df[['finance', 'rolling_mean_finance']].plot(ax=axes[2]);