Change the line width of plot() in Matplotlib

The plot() in Matplotlib pyplot takes the linewidth option that sets the line width in plots.

import numpy
from matplotlib import pyplot

x1 = numpy.arange(-7, 13, 0.1)

y1 = x1 * x1
y2 = 2 * x1 - 3

pyplot.plot(x1, y1, color='#fc3503')
pyplot.plot(x1, y2, color='#0d4ed1', linewidth=6)


The line width y2 (blue plots) is thicker than normal lines. Note that the color option sets the line color.


Powered by Markdown