How do I create a Seaborn lineplot with dots as markers?

To create a Seaborn lineplot with dots as markers, use the seaborn.lineplot() function and specify the ‘marker’ argument as ‘o’. This will cause the lineplot to be displayed with dots as markers instead of the standard line.


You can use the marker argument with a value of o to create a seaborn lineplot with dots as markers:

import seaborn as sns

sns.lineplot(data=df, x='x_var', y='y_var', marker='o')

The following example shows how to use this syntax in practice.

Example: Create Seaborn Lineplot with Dots as Markers

Suppose we have the following pandas DataFrame that contains information about the sales made during ten consecutive days at some retail store:

import pandas as pd

#create DataFrame
df = pd.DataFrame({'day': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
                   'sales': [3, 3, 5, 4, 5, 6, 8, 9, 14, 18]})

#view DataFrame
print(df)

   day  sales
0    1      3
1    2      3
2    3      5
3    4      4
4    5      5
5    6      6
6    7      8
7    8      9
8    9     14
9   10     18

If we use the lineplot() function to create a line plot in seaborn, there will be no markers by default:

However, we can use the marker argument within the lineplot() function to create a line plot with dots as the markers:

import seaborn as sns

#create lineplot with dots as markers
sns.lineplot(data=df, x='day', y='sales', marker='o')

seaborn lineplot with dots

Notice that tiny dots are now used as markers in the line plot.

Also note that we can use the markersize and markerfacecolor arguments to change the size and color, respectively, of the markers:

import seaborn as sns

#create lineplot with custom dots as markers
sns.lineplot(data=df, x='day', y='sales', marker='o',
             markersize=10, markerfacecolor='red')

seaborn lineplot with dots as markers with custom size and color

The dots are now red and have a larger size than the previous example.

Note that the default marker size is 6.

The following tutorials explain how to perform other common tasks in seaborn:

x