seaborn.objects.Line#

class seaborn.objects.Line(artist_kws=<factory>, color=<'C0'>, alpha=<1>, linewidth=<rc:lines.linewidth>, linestyle=<rc:lines.linestyle>, marker=<rc:lines.marker>, pointsize=<rc:lines.markersize>, fillcolor=<depend:color>, edgecolor=<depend:color>, edgewidth=<rc:lines.markeredgewidth>)#

A mark connecting data points with sorting along the orientation axis.

This mark defines the following properties:

color, alpha, linewidth, linestyle, marker, pointsize, fillcolor, edgecolor, edgewidth

See also

Path

A mark connecting data points in the order they appear.

Lines

A faster but less-flexible mark for drawing many lines.

Examples

The mark draws a connecting line between sorted observations:

so.Plot(dowjones, "Date", "Price").add(so.Line())
../_images/objects.Line_1_0.png

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):

so.Plot(dowjones, x="Price", y="Date").add(so.Line(), orient="y")
../_images/objects.Line_3_0.png

To replicate the same line multiple times, assign a group variable (but consider using Lines here instead):

(
    fmri
    .query("region == 'parietal' and event == 'stim'")
    .pipe(so.Plot, "timepoint", "signal")
    .add(so.Line(color=".2", linewidth=1), group="subject")
)
../_images/objects.Line_5_0.png

When mapping variables to properties like color or linestyle, stat transforms are computed within each grouping:

p = so.Plot(fmri, "timepoint", "signal", color="region", linestyle="event")
p.add(so.Line(), so.Agg())
../_images/objects.Line_7_0.png

Combine with Band to show an error bar:

(
    p
    .add(so.Line(), so.Agg())
    .add(so.Band(), so.Est(), group="event")
)
../_images/objects.Line_9_0.png

Add markers to indicate values where the data were sampled:

p.add(so.Line(marker="o", edgecolor="w"), so.Agg(), linestyle=None)
../_images/objects.Line_11_0.png