-1

I am trying to make the double bar chart dimensions bigger with figsize but my code doesn't seem to work.

plt.figure(figsize=(15,4))
MM_coh_chart = MM_coh.set_index('Snapshot_Date').plot(kind='bar', width=0.8, stacked=False, color=['red', 'steelblue'])
plt.legend(title='MPM Active Cohort vs Cohort Size', labels=['Cohort Currently Active', 'Cohort Size'], bbox_to_anchor=(1.02, 1), loc='upper left', borderaxespad=0)
plt.show(MM_coh_chart)
BigBen
  • 46,229
  • 7
  • 24
  • 40
Deke Marquardt
  • 111
  • 1
  • 9
  • 1
    `fig, ax = plt.subplots(figsize=(15, 4))`, `MM_coh.set_index('Snapshot_Date').plot(kind='bar', width=0.8, stacked=False, color=['red', 'steelblue'], ax=ax)`, `ax.legend(...)`. – BigBen Aug 19 '22 at 16:54
  • Or `MM_coh.set_index('Snapshot_Date').plot(..., figsize=(15,4))` – BigBen Aug 19 '22 at 16:56
  • Does this answer your question? [How to increase image size of pandas.DataFrame.plot](https://stackoverflow.com/questions/51174691/how-to-increase-image-size-of-pandas-dataframe-plot) – BigBen Aug 19 '22 at 16:56

1 Answers1

0

My go to is to use plt.rcParams as it changes the figure size for all downstream graphs without having to define it each time. Something like:

plt.rcParams["figure.figsize"] = (20,10)

... at the top of your code has always worked for me.

Michael S.
  • 3,050
  • 4
  • 19
  • 34