Thursday, February 9, 2012

Additional color names for matplotlib plots

When creating plots with matplotlib, we usually use the "default" color names:
  • b : blue
  • g : green
  • r : red
  • c : cyan
  • m : magenta
  • y : yellow
  • k : black
  • w : white
It turns out that matplotlib accepts not only these default color names, but the full range of html color names! So for example, you can plot some data like this:

 pylab.plot(x, y, 'DarkOrange')  

and get a "dark orange" color.

This is an easy way of specifying colors in addition to the standard ones.

4 comments:

  1. This is possibly the most useful matplotlib related post ever.

    Thanks, mate.

    ReplyDelete
  2. Dude, this really helps a lot! Thanks for the insight!

    ReplyDelete
  3. I appreciate your work on Python. It's such a wonderful read on Python tutorial. Keep sharing stuffs like this. I am also educating people on similar Python so if you are interested to know more you can watch this Python tutorial:-https://www.youtube.com/watch?v=HcsvDObzW2U

    ReplyDelete