Matplotlib Colors: The Quick Reference

Make your charts beautiful. Don't settle for the default blue and orange.

How to Set Colors

You can set colors in almost any Matplotlib plotting function using the color or c parameter.

import matplotlib.pyplot as plt

# Using a name
plt.plot(x, y, color='salmon')

# Using a Hex Code
plt.plot(x, y, color='#ff5733')

# Using RGB Tuple (0-1 range)
plt.plot(x, y, color=(0.1, 0.2, 0.5))

Popular Named Colors

These are built-in CSS4-compatible color names you can simply type as strings.

'red'
'blue'
'green'
'cyan'
'magenta'
'gold'
'salmon'
'teal'
'navy'
'olive'

Tableau Colors (Default)

Matplotlib 2.0+ uses "Tableau" colors by default. You can access them with the 'tab:' prefix.

'tab:blue'
'tab:orange'
'tab:green'
'tab:red'

Single Letter Shortcuts

For quick prototyping, you can use these shortcuts:

  • 'b': Blue
  • 'g': Green
  • 'r': Red
  • 'c': Cyan
  • 'm': Magenta
  • 'y': Yellow
  • 'k': Black
  • 'w': White