How to add additional plots to a seaborn FacetGrid and specify colors

I think you want units in the call to relplot and then add a layer of lineplot using map:

import seaborn as sns
import pandas as pd

fm = sns.load_dataset('fmri').query("event == 'stim'")
g = sns.relplot(
    data=fm, kind='line',
    col="region", x='timepoint', y='signal', units="subject",
    estimator=None, color=".7"
)
g.data = fm  # Hack needed to work around bug on v0.11, fixed in v0.12.dev
g.map(sns.lineplot, 'timepoint', 'signal', color="r", ci=None, lw=3)

enter image description here

Leave a Comment