pythonseabornfacet-gridrelplot

How to add margin titles to a relplot


Seaborn's FacetGrid has a margin_titles kwarg, and its effect is shown in the documentation e.g.

enter image description here

How do I similarly add margin titles when using Seaborn's relplot?


Solution

  • I am not sure how you want to use it, but this can be given in a dict in the facet_kws argument.

    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