Connected Scatterplot

A connected scatterplot is a line chart where each data point is shown by a circle or any type of marker. This section explains how to build a connected scatterplot with Python, using both the Matplotlib and the Seaborn libraries.
⏱ Quick start
Building a connected scatterplot with Python and Matplotlib is a breeze thanks to the plot() function. The 2 first argumenst are the X and Y values respectively, which can be stored in a pandas data frame.
The linestyle and marker arguments allow to use line and circles to make it look like a connected scatterplot. It means everything is very close to a line chart or a scatterplot that are extensively described in the gallery.
# libraries
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
# data
df = pd.DataFrame({
'x_axis': range(1,10),
'y_axis': np.random.randn(9)*80+range(1,10)
})
# plot
plt.plot('x_axis', 'y_axis', data=df, linestyle='-', marker='o')
plt.show()
⚠️ Two types of connected scatterplot
There are two types of connected scatterplot, and it often creates confusion.
The first is simply a lineplot with dots added on top of it. It takes as input 2 numeric variables only. The second shows the relationship between 2 numeric variables across time. It requires 3 numeric variables as input.
Confusing? Visit data-to-viz to clarify..
Connected scatterplot with Seaborn
Building a connected scatterplot with Seaborn looks pretty much the same as for a line chart. It is made thanks to the lineplot() function.
Click the following images to get a long form tutorial on how to create a basic connected scatterplot with Seaborn, how to draw multiple groups and how to customize the lines and the markers.



