While there is no built-in way to do this in the sea, you can manipulate the patches that the sns.barplotmatplotlib axes create on the object.
, , .
, 1 , 0-1.
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_style("whitegrid")
tips = sns.load_dataset("tips")
ax = sns.barplot(x="day", y="total_bill", data=tips)
columncounts = [20,40,60,80]
def normaliseCounts(widths,maxwidth):
widths = np.array(widths)/float(maxwidth)
return widths
widthbars = normaliseCounts(columncounts,100)
for bar,newwidth in zip(ax.patches,widthbars):
x = bar.get_x()
width = bar.get_width()
centre = x+width/2.
bar.set_x(centre-newwidth/2.)
bar.set_width(newwidth)
plt.show()
