Draw a horizontal line line at specific position/annotate a Facetgrid in seaborn

前端 未结 4 765
北恋
北恋 2021-02-05 07:07

A have produced a boxplot with Facetgrid in seaborn the following way

# Import the dataset
tips = sns.load_dataset(\"tips\")

# Plot using Facegrid, separated by         


        
4条回答
  •  无人共我
    2021-02-05 08:03

    There is axhline and hlines. Simple example:

    chart = sns.relplot(x="x", y="y", kind="line", data=df)
    
    chart.axes[0][0].axhline(y = 10, color='black', linewidth=2, alpha=.7)
    chart.axes[0][0].hlines( y = 20, color='black', linewidth=2, alpha=.7, 
                             xmin = 30, xmax = 50) 
    

    Seems like hlines allows for min-max (documentation) but axhline doesn't.

提交回复
热议问题