Seaborn Barplot - Displaying Values

后端 未结 6 787
不知归路
不知归路 2020-11-27 14:39

I\'m looking to see how to do two things in Seaborn with using a bar chart to display values that are in the dataframe, but not in the graph

1) I\'m looking to displ

6条回答
  •  醉酒成梦
    2020-11-27 15:05

    Hope this helps for item #2: a) You can sort by total bill then reset the index to this column b) Use palette="Blue" to use this color to scale your chart from light blue to dark blue (if dark blue to light blue then use palette="Blues_d")

    import pandas as pd
    import seaborn as sns
    %matplotlib inline
    
    df=pd.read_csv("https://raw.githubusercontent.com/wesm/pydata-book/master/ch08/tips.csv", sep=',')
    groupedvalues=df.groupby('day').sum().reset_index()
    groupedvalues=groupedvalues.sort_values('total_bill').reset_index()
    g=sns.barplot(x='day',y='tip',data=groupedvalues, palette="Blues")
    

提交回复
热议问题