if you are looking for just one bar for each of the columns s1, s2, s9 and the sum of all the columns in those to be the height of each of these bars, you should be using barplot()
instead. Get the sum of each column using sum()
and then plot it. Below code shows this for some random data. The sum() will get the total for each column and doing a reset_index() will add the column names as a column index. You can try print box_data.sum().reset_index()
to understand how the sum data looks like.
Code
data = {'s1': np.random.randint(20,160, size=(100)),
's2':np.random.randint(16,80, size=(100)),
's9':np.random.randint(60,170, size=(100))}
box_data=pd.DataFrame(data)
sns.barplot(data = box_data.sum().reset_index(), y=0, x= 'index')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.