Change the plot color in Matplotlib

The plot() in Matplotlib pyplot takes the color option.

import numpy
from matplotlib import pyplot

x = numpy.arange(-7, 13, 0.1)
y = numpy.array([a * a for a in x])

pyplot.plot(x, y, color='#fc3503')

pyplot.savefig('color.jpg')

The color of curve is #fc3503. The default color is dark blue.

Comments

Powered by Markdown