0

I made a bar plot using seaborn. I want to make the bars slimmer. From my understanding this should be as simple as changing the width of the bars to a smaller value than the default 0.8. However when I change the width to something like 0.5, I get the following error:

typeerror: bar() got multiple values for argument 'width'

I only call the parameter width once, so I am a bit confused about why I am getting this error.

My code is below:

plot_order = data.groupby('Image')['Area (microns squared)'].sum().sort_values(ascending=False).index.values
color = (sns.color_palette("Paired"))
sns.set(font_scale=2)
sns.set_style(style='white')
fig, ax = plt.subplots(figsize=(9,8))
ax = sns.barplot(x='Image',y='Area (microns squared)', data = data, 
                 palette=color, order = plot_order,capsize= .1, width = 0.5)

plt.xlabel("Treatment")
plt.ylabel("Area (microns squared)")

Here is an example of the data that I am working with:

temp = [['STZ', 26376], ['Control', 31886], ['STZ', 28548], 
        ['Control', 31000],['STZ', 29607], ['Control', 36659], ['Control', 32002] ]
  
data = pd.DataFrame(data, columns=['Image', 'Area (microns squared)'])

Adriana
  • 91
  • 8

0 Answers0