How to add markers to a Matplotlib plot using Python

1 min

Markers are extremely useful to make your plots cleaner.

Using Matplotlib markers you can add markers when you do a line plot.

Here is the code

# To plot
import matplotlib.pyplot as plt

# We setup our canvas
fig, axes = plt.subplots(1,1, figsize=(8,4))

# we plot
axes.plot(range(0,10), 
		 marker = 'o') # Here you can change the type of marker you want

plt.show()

Here is the result

Here you are! You now know how to add markers to a Matplotlib plot using Python.

More on Matplotlib

If you like what you've just read and want to know more about the Matplotlib library (e.g. how to add labels, plot different types of plots, etc...) check out the other articles I wrote on the topic, just here :

Matplotlib - The Python You Need
We gathered the only Python essentials that you will probably ever need.