Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Connect color maps to Python and matplotlib

Project Description


brewer2mpl is now Palettable! brewer2mpl will no longer be updated, but will stay available here for the foreseeable future.

brewer2mpl is a pure Python package for accessing color maps from Python. With brewer2mpl you can get the raw RGB colors of all 165 color maps. The color map data ships with brewer2mpl so no internet connection is required.

For more information and to view some of the color maps see the wiki at

Color Maps has 3 map types: sequential, diverging, and qualitative. Each color map has between 3 and 12 defined colors.


Listing Color Maps

List all of the available color maps:


List maps by type:


Filter by number of colors defined:

brewer2mpl.print_maps('qualitative', 6)

Get a Color Map

Color maps are accessed by name, type, and number:

bmap = brewer2mpl.get_map('Paired', 'Qualitative', 5)

If you want a color map reversed from how it is given by set the reverse keyword to True:

bmap = brewer2mpl.get_map('Paired', 'Qualitative', 5, reverse=True)

BrewerMap Objects

Color maps are represented by BrewerMap objects. They have a few useful attributes:

# url.

# name

# number of defined colors

# colors as a list of RGB 0-255 triplets

# colors as a list of hex strings

# colors as a list of RGB 0-1 triplets (as used by matplotlib)

# matplotlib color map

To launch your browser and see a color map at use the colorbrewer2 method:


The matplotlib color maps are created using matplotlib.colors.LinearSegmentedColormap.from_list. If you want to pass options to that method use the BrewerMap.get_mpl_colormap method:

cmap = bmap.get_mpl_colormap(N=1000, gamma=2.0)

Direct Access

If you know the color map you want there is a shortcut for direct access. You can import the sequential, diverging, or qualitative modules from brewer2mpl. On the module namespace are dictionaries containing BrewerMap objects keyed by number of defined colors.

Say you want the Dark2 qualitative color map with 7 colors. To get it directly you can do:

from brewer2mpl import qualitative
bmap = qualitative.Dark2[7]

There is also a special key ‘max’ for each name that points to the color map with the most defined colors:

from brewer2mpl import sequential
bmap = sequential.YlGnBu['max']
Release History

Release History

This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
brewer2mpl-1.4.1-py2.py3-none-any.whl (24.1 kB) Copy SHA256 Checksum SHA256 any Wheel Sep 19, 2014
brewer2mpl-1.4.1.tar.gz (23.6 kB) Copy SHA256 Checksum SHA256 Source Sep 19, 2014 (29.3 kB) Copy SHA256 Checksum SHA256 Source Sep 19, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting