doc/_docstrings/relplot.ipynb
import seaborn as sns
import matplotlib.pyplot as plt
sns.set_theme(style="ticks")
tips = sns.load_dataset("tips")
tips.head()
sns.relplot(data=tips, x="total_bill", y="tip", hue="day")
sns.relplot(data=tips, x="total_bill", y="tip", hue="day", col="time")
sns.relplot(data=tips, x="total_bill", y="tip", hue="day", col="time", row="sex")
sns.relplot(data=tips, x="total_bill", y="tip", hue="time", col="day", col_wrap=2)
sns.relplot(
data=tips, x="total_bill", y="tip", col="time",
hue="time", size="size", style="sex",
palette=["b", "r"], sizes=(10, 100)
)
fmri = sns.load_dataset("fmri")
fmri.head()
sns.relplot(
data=fmri, x="timepoint", y="signal", col="region",
hue="event", style="event", kind="line",
)
sns.relplot(
data=fmri,
x="timepoint", y="signal",
hue="event", style="event", col="region",
height=4, aspect=.7, kind="line"
)
g = sns.relplot(
data=fmri,
x="timepoint", y="signal",
hue="event", style="event", col="region",
height=4, aspect=.7, kind="line"
)
(g.map(plt.axhline, y=0, color=".7", dashes=(2, 1), zorder=0)
.set_axis_labels("Timepoint", "Percent signal change")
.set_titles("Region: {col_name} cortex")
.tight_layout(w_pad=0))
flights_wide = (
sns.load_dataset("flights")
.pivot(index="year", columns="month", values="passengers")
)
sns.relplot(data=flights_wide, kind="line")