I have a pandas dataframe and I am trying to create boxplot using Matplotlib. I am able to get the boxplot but it looks like styling for boxplot (color for boxplot components) is not working. I am trying to learn plotting charts but somewhat confused how all elements come together. Any guidance will be highly appreciated.
import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline
fig, ax = plt.subplots(figsize=(20,6))
ax.set_title('Height Distribution')
ax.set_xlabel('PANEL')
ax.set_ylabel('Height (um)')
# Define styling for each boxplot component
medianprops = {'color': 'magenta', 'linewidth': 2}
boxprops = {'color': 'black', 'linestyle': '-'}
whiskerprops = {'color': 'red', 'linestyle': '-'}
capprops = {'color': 'green', 'linestyle': '-'}
flierprops = {'color': 'yellow', 'marker': 'x'}
concatenated_df.boxplot(ax=ax, column='HEIGHT',by=['Label'],rot=90,fontsize=15,medianprops=medianprops,
boxprops=boxprops,
whiskerprops=whiskerprops,
capprops=capprops,
flierprops=flierprops)
# Save figure
fig.savefig("filename.jpg")