Basic Connected Scatterplot with Matplotlib


This post explains how to produce a basic connected scatterplot using matplotlib and provides a reproducible code.

Connected scatterplots are just a mix between scatterplots and linecharts. It can be made using the plot() function of matplotlib with the possible parameters:

  • x : The horizontal coordinates of the data points
  • y : The vertical coordinates of the data points
  • data : An object with labelled data
  • linestyle : Line style can be one of these {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
  • marker : Marker style

If you want to customize them, just check the scatter and line sections of the website!

# libraries
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
 
# 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()

Scatterplot

Heatmap

Correlogram

Bubble

Connected Scatter

2D Density

Contact & Edit

👋 This document is a work by Yan Holtz. Any feedback is highly encouraged. You can fill an issue on Github, drop me a message onTwitter, or send an email pasting yan.holtz.data with gmail.com.

This page is just a jupyter notebook, you can edit it here. Please help me making this website better 🙏!

Violin

Density

Histogram

Boxplot

Ridgeline

Scatterplot

Heatmap

Correlogram

Bubble

Connected Scatter

2D Density

Barplot

Spider / Radar

Wordcloud

Parallel

Lollipop

Circular Barplot

Treemap

Venn Diagram

Donut

Pie Chart

Dendrogram

Circular Packing

Line chart

Area chart

Stacked Area

Streamgraph

Map

Choropleth

Hexbin

Cartogram

Connection

Bubble

Chord Diagram

Network

Sankey

Arc Diagram

Edge Bundling

Colors

Interactivity

Animation with python

Animation

Cheat sheets

Caveats

3D