Matplotlib – Change the line width

To change the line width of a line graph in Matplotlib, use the linewidth parameter of the plot() function. Let us see an example:

# Set the line width

import matplotlib.pyplot as plt
import numpy as np

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

plt.plot(ypts, linewidth='10')
plt.show()

Output

Change the line width 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:

Matplotlib - Change the line color
Create Markers in Matplotlib
Studyopedia Editorial Staff
contact@studyopedia.com

We work to create programming tutorials for all.

No Comments

Post A Comment