Line charts

Seaborn basics

1 min read

Published Oct 7 2025, updated Aug 17 2026


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 snsimport matplotlib.pyplot as pltdata = 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 snsimport matplotlib.pyplot as pltdata = 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 snsimport matplotlib.pyplot as pltdata = 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 snsimport matplotlib.pyplot as pltdata = 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 snsimport matplotlib.pyplot as pltdata = 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 snsimport matplotlib.pyplot as pltimport numpy as npdata = 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 snsimport matplotlib.pyplot as pltdata = 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
© 2025 SimpleSteps.guide
AboutFAQPoliciesContact
Seaborn basics | Line charts | SimpleSteps.guide