Set the Marker face color in Matplotlib

In Matplotlib, you set the marker face color using the markerfacecolor (or its shorthand mfc) parameter in plotting functions like plot() or scatter(). This controls the fill color inside the marker, separate from the edge color.

Let us see an example:

# Set the Marker face 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',mfc = 'g', linestyle='-', color='red')
plt.show()

Output



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:

Set the Marker edge color in Matplotlib
Matplotlib - Create multiple plots (side by side) in one figure
Studyopedia Editorial Staff
contact@studyopedia.com

We work to create programming tutorials for all.

No Comments

Post A Comment