Color Brewer

Set2 color palette chosen in Color Brewer
Set2 color palette chosen in Color Brewer

Color is an important parameter in any plot or visualization. For plotting many types of data, you may have to pick multiple colors or a color map. Depending on the purpose of the visualization and the data being presented, you may want the picked colors to be vary in a certain order or you may want them to be as diverse as possible. A color palette is an ordered set of colors that is designed with these factors in mind.

Color Brewer is a popular set of color palettes designed for cartography. It provides 3 types of color palettes: sequential, diverging and qualitative. Under each category, it provides multiple color palettes. It has a fantastic online palette picker that makes it convenient to pick the color palette suitable for your application. Choose the number of classes in your data from the dropdown, then pick one of the 3 classes that suits your purpose and you can see the color palettes that are suitable for this. (See screenshot above.)

The color palettes from Color Brewer are available in Matplotlib and Seaborn. For example, for a line plot with 10 curves, I needed a palette of 10 colors. I picked them from the Set2 color palette like this:

import seaborn
color_palette = seaborn.color_palette("Set2", 10)

Tried with: Seaborn 0.5.1 and Ubuntu 14.04


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.