Connected Scatterplot

logo of a chart:ScatterConnected

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

# 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..

Seaborn logoConnected 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.