List of Matplotlib Common Used Colors – Matplotlib Tutorial

By | February 24, 2021

Color is an important part in matplotlib, in this tutorial, we will list some most used in plots.

How to use color in matplotlib?

We can use color name to change the color of plots. Here are some examples:

Set the bar color

The code is:

import matplotlib as plt
plt.bar(['train', 'test'], [len(train), len(test)], color=['aquamarine', 'dodgerblue'], width=0.5)
plt.ylabel('Number of Patents')

Here we use color=[‘aquamarine’, ‘dodgerblue’] to change the color of bar in matplotlib.

The bar looks like:

the bar color example in matplotlib

We also can change the color of line in matplotlib. Here is an example:

plt.plot(patent_num, color='deepskyblue')
plt.xlabel('CompanyID')
plt.ylabel('NumberOfPatent')

We use color=’deepskyblue’ to change its color.

It looks like:

the line color example in matplotlib

In most situation, we can use color name to change the color of plots in matplotlib.

List of Matplotlib Colors

In order to use color in matplotlib, we list some common used in application. They are:

a full list of matplotlib color

Leave a Reply