Home > Blockchain >  Matching plot line colour with the name of the division
Matching plot line colour with the name of the division

Time:10-11

I have been trying to plot mean of 'Sales' for 7 divisions (blue, green, grey, orange, purple, red, yellow) for each response month. Here is a code snippet:

subset_sales = (df_2.pivot_table(index=['Response Month (YYYY-MM)'],
                                 columns='Division', values='Sales')
                .reset_index()
                .set_index('Response Month (YYYY-MM)')
                )
subset_sales.plot(kind='line', rot=90)
plt.tight_layout()
plt.show()

enter image description here

  • Related