代码之家  ›  专栏  ›  技术社区  ›  Rylan Schaeffer

Seaborn:如何在情节中添加边距标题?

  •  0
  • Rylan Schaeffer  · 技术社区  · 2 年前

    Seaborn的FaceGrid有一个 margin_titles kwarg,其效果如图所示 documentation 例如

    enter image description here

    在使用Seaborn's时,我如何添加类似的页边标题 relplot ?

    1 回复  |  直到 2 年前
        1
  •  1
  •   bert wassink    2 年前

    我不确定你想如何使用它,但这可以在facet_kws论点中的一个dict中给出。

    import seaborn as sns
    tips = sns.load_dataset("tips")
    
    sns.relplot(
        data=tips,
        x="total_bill",
        y="tip",
        hue="time",
        col="day",
        row="smoker",  
        facet_kws={"margin_titles": True}
    )
    

    enter image description here