matplotlib.pyplot.colors
1. use single letter
Alias | Color |
---|---|
‘b’ | blue |
‘g’ | green |
‘r’ | red |
‘c’ | cyan |
‘m’ | magenta |
‘y’ | yellow |
‘k’ | black |
‘w’ | white |
2. use an html hex string
For a greater range of colors, you have two options. You can specify the color using an html hex string, as in:
color = '#eeefff'
3. use RGB tuple
or you can pass an R,G,B tuple, where each of R,G,B are in the range [0,1].
You can also use any legal html name for a color, for example:
color = 'red'
color = 'burlywood'
color = 'chartreuse'
The example below creates a subplot with a dark slate gray background:
subplot(111, facecolor=(0.1843, 0.3098, 0.3098))
Here is an example that creates a pale turquoise title:
title('Is this the best color?', color='#afeeee')