Thursday, 20 August 2020

seaborn 3 facets

 import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from scipy import signal
sns.set(style="darkgrid")

tips = sns.load_dataset("tips")
tips.head()

  total_bill tip sex smoker day time size
0 16.99 1.01 Female No Sun Dinner 2
1 10.34 1.66 Male No Sun Dinner 3
2 21.01 3.50 Male No Sun Dinner 3
3 23.68 3.31 Male No Sun Dinner 2
4 24.59 3.61 Female No Sun Dinner 4

sns.relplot(x="total_bill", y="tip", hue="smoker",
            col="time", data=tips);

fmri = sns.load_dataset("fmri")
fmri.tail(10)

  subject timepoint event region signal
1054 s5 8 cue frontal -0.028292
1055 s4 8 cue frontal -0.160821
1056 s3 8 cue frontal -0.033848
1057 s2 8 cue frontal -0.069666
1058 s1 8 cue frontal -0.136059
1059 s0 8 cue frontal 0.018165
1060 s13 7 cue frontal -0.029130
1061 s12 7 cue frontal -0.004939
1062 s11 7 cue frontal -0.025367
1063 s0 0 cue parietal -0.006899

sns.relplot(x="timepoint", y="signal", hue="event", style="event",
            col="subject", col_wrap=4,
            height=3, aspect=.75, linewidth=2.5,
            kind="line", data=fmri.query("region == 'frontal'"));


reference:

No comments:

Post a Comment