'Seaborn: 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 1:[1]

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 bert wassink