Back to Seaborn

Lineplot

doc/_docstrings/lineplot.ipynb

0.13.22.5 KB
Original Source
python
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib as mpl
import matplotlib.pyplot as plt
sns.set_theme()
python
flights = sns.load_dataset("flights")
flights.head()
python
may_flights = flights.query("month == 'May'")
sns.lineplot(data=may_flights, x="year", y="passengers")
python
flights_wide = flights.pivot(index="year", columns="month", values="passengers")
flights_wide.head()
python
sns.lineplot(data=flights_wide["May"])
python
sns.lineplot(data=flights_wide)
python
sns.lineplot(data=flights, x="year", y="passengers")
python
sns.lineplot(data=flights, x="year", y="passengers", hue="month")
python
sns.lineplot(data=flights, x="year", y="passengers", hue="month", style="month")
python
sns.lineplot(data=flights, x="passengers", y="year", orient="y")
python
fmri = sns.load_dataset("fmri")
fmri.head()
python
sns.lineplot(data=fmri, x="timepoint", y="signal", hue="event")
python
sns.lineplot(data=fmri, x="timepoint", y="signal", hue="region", style="event")
python
sns.lineplot(
    data=fmri,
    x="timepoint", y="signal", hue="event", style="event",
    markers=True, dashes=False
)
python
sns.lineplot(
    data=fmri, x="timepoint", y="signal", hue="event", err_style="bars", errorbar=("se", 2),
)
python
sns.lineplot(
    data=fmri.query("region == 'frontal'"),
    x="timepoint", y="signal", hue="event", units="subject",
    estimator=None, lw=1,
)
python
dots = sns.load_dataset("dots").query("align == 'dots'")
dots.head()
python
sns.lineplot(
    data=dots, x="time", y="firing_rate", hue="coherence", style="choice",
)
python
sns.lineplot(
    data=dots.query("coherence > 0"),
    x="time", y="firing_rate", hue="coherence", style="choice",
     palette="flare", hue_norm=mpl.colors.LogNorm(),
)
python
palette = sns.color_palette("mako_r", 6)
sns.lineplot(
    data=dots, x="time", y="firing_rate",
    hue="coherence", style="choice",
    palette=palette
)
python
sns.lineplot(
    data=dots, x="time", y="firing_rate",
    size="coherence", hue="choice",
    legend="full"
)
python
sns.lineplot(
    data=dots, x="time", y="firing_rate",
    size="coherence", hue="choice",
    sizes=(.25, 2.5)
)
python
x, y = np.random.normal(size=(2, 5000)).cumsum(axis=1)
sns.lineplot(x=x, y=y, sort=False, lw=1)
python
sns.relplot(
    data=fmri, x="timepoint", y="signal",
    col="region", hue="event", style="event",
    kind="line"
)