I simply want to manually adjust the width of a barplot in seaborn but I run into the error TypeError: bar() got multiple values for argument 'width'
This is what produced the error:
#create DataFrame
import pandas as pd
import seaborn as sns
df = pd.DataFrame({'employee': ['Andy'],
'sales': [22]})
#create bar plot with width = 0.4
sns.barplot(x='employee', y='sales', data=df, width=0.4)
As a workaround, I tried setting patch.set_width():
#create DataFrame
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
df = pd.DataFrame({'employee': ['Andy'],
'sales': [22]})
#create bar plot with width = 0.4
# now using patch.set_width
fig, ax = plt.subplots(figsize=(5,5))
ax.patch.set_width(0.6)
ax = sns.barplot(x='employee', y='sales', data=df)
However, this decenters the bar, which I don't want. Thanks for your help!