I have plotted matplotlib subplots generated from a pandas dataframe on a web page using Flask. Here's the relevant code.
import matplotlib.pyplot as plt
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
from io import BytesIO,StringIO
plt.style.use('ggplot')
plt.rcParams['xtick.color']='k'
plt.rcParams['xtick.labelsize']='x-large'
travel_df_new.unstack(level=0).plot(kind='bar', subplots=True, legend=False)
buff = BytesIO()
plt.savefig(buff, format='png', dpi=100)
buff.seek(0)
The x axes labels always tend to get cut off , even if I set plt.rcParams['xtick.labelsize']='x-small'.
Also, haven't found a way to rotate xtick labels inside rcParams.
My image is not covering the entire web page, so not sure if I need rotation.