Line charts

Seaborn basics

1 min read

Published Oct 7 2025


24
0
0
0

ChartsGraphsMatplotlibNumPyPandasPythonSeabornVisualisation

seaborn.lineplot() draws a line plot — showing the relationship between two continuous variables, often used to display trends over time or aggregated relationships.


Syntax:

sns.lineplot(
    data=None,
    x=None,
    y=None,
    hue=None,
    style=None,
    size=None,
    palette=None,
    markers=False,
    dashes=True,
    ci='auto',
    estimator='mean',
    **kwargs
)

Parameters:

  • data = DataFrame containing data
  • x, y = Columns to plot
  • hue = Colours (categorical/numerical grouping)
  • style = Line style or marker shape for groups
  • size = Line thickness based on a variable
  • palette = Colour palette for hue
  • markers = Add point markers (True or column name)
  • dashes = Control line dash patterns
  • ci = Confidence interval ('sd', 'auto', None)
  • estimator = Function to aggregate data (default = mean)




Basic example

import seaborn as sns
import matplotlib.pyplot as plt

data = sns.load_dataset("fmri")

sns.lineplot(data=data, x="timepoint", y="signal")
plt.show()

Plots the average signal value at each timepoint.


seaborn line plot basic example





Adding hue (colour)

import seaborn as sns
import matplotlib.pyplot as plt

data = sns.load_dataset("fmri")

sns.lineplot(data=data, x="timepoint", y="signal", hue="event")
plt.show()

Lines coloured by event category.


seaborn line plot hue example





Multiple dimensions (hue, style, size)

import seaborn as sns
import matplotlib.pyplot as plt

data = sns.load_dataset("fmri")

sns.lineplot(
    data=data,
    x="timepoint",
    y="signal",
    hue="event",
    style="region",
    size="region"
)
plt.show()

  • hue → colour
  • style → different line types (solid, dashed)
  • size → line thickness

seaborn line plot hue size style example





Show data points with markers

import seaborn as sns
import matplotlib.pyplot as plt

data = sns.load_dataset("fmri")

sns.lineplot(
    data=data,
    x="timepoint",
    y="signal",
    hue="event",
    style="event",
    markers=True,
    dashes=False
)
plt.show()

Adds markers for data points, disables dashed lines.


seaborn line plot datapoint marker example





Control confidence intervals

import seaborn as sns
import matplotlib.pyplot as plt

data = sns.load_dataset("fmri")

sns.lineplot(data=data, x="timepoint", y="signal", hue="event", ci=None)
plt.show()

  • ci=None removes shaded confidence intervals.
  • ci='sd' shows standard deviation bands.

seaborn line plot ci example





Use a custom estimator

import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np

data = sns.load_dataset("fmri")

sns.lineplot(data=data, x="timepoint", y="signal", hue="event", estimator=np.median)
plt.show()

Uses median instead of mean for aggregation.


seaborn line plot custom estimator example





Customise appearance

import seaborn as sns
import matplotlib.pyplot as plt

data = sns.load_dataset("fmri")

sns.lineplot(
    data=data,
    x="timepoint",
    y="signal",
    hue="event",
    palette="coolwarm",
    linewidth=2.5,
    markers=True,
    dashes=False
)
plt.show()

seaborn line plot custom example

Products from our shop

Docker Cheat Sheet - Print at Home Designs

Docker Cheat Sheet - Print at Home Designs

Docker Cheat Sheet Mouse Mat

Docker Cheat Sheet Mouse Mat

Docker Cheat Sheet Travel Mug

Docker Cheat Sheet Travel Mug

Docker Cheat Sheet Mug

Docker Cheat Sheet Mug

Vim Cheat Sheet - Print at Home Designs

Vim Cheat Sheet - Print at Home Designs

Vim Cheat Sheet Mouse Mat

Vim Cheat Sheet Mouse Mat

Vim Cheat Sheet Travel Mug

Vim Cheat Sheet Travel Mug

Vim Cheat Sheet Mug

Vim Cheat Sheet Mug

SimpleSteps.guide branded Travel Mug

SimpleSteps.guide branded Travel Mug

Developer Excuse Javascript - Travel Mug

Developer Excuse Javascript - Travel Mug

Developer Excuse Javascript Embroidered T-Shirt - Dark

Developer Excuse Javascript Embroidered T-Shirt - Dark

Developer Excuse Javascript Embroidered T-Shirt - Light

Developer Excuse Javascript Embroidered T-Shirt - Light

Developer Excuse Javascript Mug - White

Developer Excuse Javascript Mug - White

Developer Excuse Javascript Mug - Black

Developer Excuse Javascript Mug - Black

SimpleSteps.guide branded stainless steel water bottle

SimpleSteps.guide branded stainless steel water bottle

Developer Excuse Javascript Hoodie - Light

Developer Excuse Javascript Hoodie - Light

Developer Excuse Javascript Hoodie - Dark

Developer Excuse Javascript Hoodie - Dark

© 2025 SimpleSteps.guide
AboutFAQPoliciesContact