0

How can we adjust the size of the chart in seaborn barplot? I have researched some of the possible parameters, however I didn't find how to adjust. Please see below for reference:

Code:

## Merge in the original country codes provided in the dataset
countries = df[['Country', 'Country_code']].drop_duplicates().reset_index(drop=True)
df_cam2 = df_cam.merge(countries, how='left', on='Country_code')
df_cam2.head()

## Bar graphs
g = sns.FacetGrid(df_cam2, col='Campaign', col_wrap=3)
g.map(sns.barplot, 'Country', 'Accepted (%)', width=0.8)

for ax, pval in zip(g.axes.flat, stat_results):
    ax.text(0, 65, "Chisq p-value: "+str(pval), fontsize=9) #add text;

Parameters:

seaborn.barplot(data=None, *, x=None, y=None, hue=None, order=None, hue_order=None, estimator='mean', errorbar=('ci', 95), n_boot=1000, units=None, seed=None, orient=None, color=None, palette=None, saturation=0.75, width=0.8, errcolor='.26', errwidth=None, capsize=None, dodge=True, ci='deprecated', ax=None, **kwargs)

Current output: enter image description here

jislesplr
  • 39
  • 6
  • 2
    You need `height=` and `aspect=` in `sns.FacetGrid`. Note, it is highly recommended to use `sns.catplot(kind='bar', ...)` which combines a `FacetGrid` and a `barplot`. – JohanC Jan 31 '23 at 06:47

0 Answers0