0

Trying to set the width of the bars on a horizontal bar plot with Seaborn but am getting the following error:

TypeError: barh() got multiple values for argument 'width'

This is the code:

top_10_pop = df.sort_values(by="Residents").tail(10)
sns.barplot(data=top_10_pop, x="Residents", y="Commune", width=1)
plt.show()

Other answers state that this is an issue with the position of the parameters, but I tried to change it, use height instead because this is an horizontal plot, nothing works. Without the width parameter, I see the chart with no issues.

How to set the width of the bars in this case?

EDIT
I am use version 0.11.2 and trying the exact example on Seaborn website fails with same error. Maybe some compatibility issue with this version and/or my matplotlib version...

evilmandarine
  • 4,241
  • 4
  • 17
  • 40
  • This functionality isn't supported yet in seaborn 0.11.2. You'd need seaborn 0.12. I think there don't exist simple workarounds (apart from upgrading). – JohanC Jun 30 '23 at 17:12

0 Answers0