Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a function to return all single letter colors in Matplotlib?

I learnt of matplotlib.pyplot.colors that the basic built-in colors can be represented as a single letter.

  • b: blue
  • g: green
  • r: red
  • c: cyan
  • m: magenta
  • y: yellow
  • k: black
  • w: white

Is there a function in Matplotlib to return those colors?

like image 988
SparkAndShine Avatar asked Jun 07 '16 14:06

SparkAndShine


1 Answers

The built in colors are available via matplotlib.colors.ColorConverter.colors

>>> print(matplotlib.colors.ColorConverter.colors)
{u'b': (0.0, 0.0, 1.0),
 u'c': (0.0, 0.75, 0.75),
 u'g': (0.0, 0.5, 0.0),
 u'k': (0.0, 0.0, 0.0),
 u'm': (0.75, 0, 0.75),
 u'r': (1.0, 0.0, 0.0),
 u'w': (1.0, 1.0, 1.0),
 u'y': (0.75, 0.75, 0)}
like image 139
Andy Avatar answered Oct 13 '22 05:10

Andy