Set the Marker edge color in Matplotlib

In Matplotlib, you can set the marker edge color using the markeredgecolor parameter (or its shorthand mec) in plotting functions like plot(), scatter(), etc. This lets you control the outline color of markers independently from their fill color.

Let us see an example:

# Set the Marker edge color in Matplotlib

import matplotlib.pyplot as plt
import numpy as np

ypts = np.array([7, 3, 9, 1, 5])

plt.plot(ypts, marker='*', ms = 25, mec = 'b', linestyle='-', color='red')
plt.show()

Output

Set the Marker edge color in Matplotlib


If you liked the tutorial, spread the word and share the link and our website, Studyopedia, with others.


For Videos, Join Our YouTube Channel: Join Now


Read more:

Marker size in Matplotlib
Set the Marker face color in Matplotlib
Studyopedia Editorial Staff
contact@studyopedia.com

We work to create programming tutorials for all.

No Comments

Post A Comment