Back to Seaborn

Objects.Line

doc/_docstrings/objects.Line.ipynb

0.13.21.0 KB
Original Source
python
import seaborn.objects as so
from seaborn import load_dataset
dowjones = load_dataset("dowjones")
fmri = load_dataset("fmri")

The mark draws a connecting line between sorted observations:

python
so.Plot(dowjones, "Date", "Price").add(so.Line())

Change the orientation to connect observations along the opposite axis (orient="y" is redundant here; the plot would detect that the date variable has a lower orientation priority than the price variable):

python
so.Plot(dowjones, x="Price", y="Date").add(so.Line(), orient="y")
python
(
    fmri
    .query("region == 'parietal' and event == 'stim'")
    .pipe(so.Plot, "timepoint", "signal")
    .add(so.Line(color=".2", linewidth=1), group="subject")
)
python
p = so.Plot(fmri, "timepoint", "signal", color="region", linestyle="event")
p.add(so.Line(), so.Agg())
python
(
    p
    .add(so.Line(), so.Agg())
    .add(so.Band(), so.Est(), group="event")
)
python
p.add(so.Line(marker="o", edgecolor="w"), so.Agg(), linestyle=None)