Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adjusting Size of Seaborn Plot [duplicate]

I've tried as many solutions as I could find on here, but I'm not having much luck on this. I'm not sure if it's because some of my settings, but I am unable to reshape my Seaborn countplot. Here's my code where I plot the figure:

sns.set_style('whitegrid')
sns.set(font_scale=1.3)
sns.countplot(x=df['QuarterYear'], hue=df['Modifier'])
ax = plt.gca()

for p in ax.patches:
    ax.text(p.get_x() + p.get_width()/2., p.get_height(), '%d' % int(p.get_height()), 
            fontsize=12, color='black', ha='center', va='bottom')

plt.legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)

I am also editing the legend and labeling my countplot columns in the same block of code.

I am using Jupyter Notebook %inline. If anyone could explain what I am missing, that would be great. I've tried many, many variations of these solutions, to no avail.

How do I change the figure size for a seaborn plot?

How to make seaborn.heatmap larger (normal size)?

How do I change the plot size of a regplot in Seaborn?

Any help would be appreciated. Thank you for your time!

like image 751
Angus Gray Avatar asked Jul 24 '18 15:07

Angus Gray


1 Answers

Have you tried:

fig = plt.gcf()
fig.set_size_inches( 16, 10)
like image 118
Learning is a mess Avatar answered Nov 02 '22 04:11

Learning is a mess