Quickstart Guide

How to use rahrah:

  • To list all palettes and their properties:

from rahrah.palette import list_palettes

list_palettes()

You can also filter for number of colors in the color cycle or type of colormap (sequential/diverging) with the arguments mincolors and maptype.

  • To list all colormaps:

from rahrah.cmap import list_maps

list_maps()
  • To set palette as default for both color cycle *and* colormap:

from rahrah.palette import set_default

set_default('Northwestern')
  • To set a palette as default for color cycle *or* colormap:

from rahrah.palette import set_default_ccycle, set_default_cmap

set_default_ccycle('ChicagoBright')

or

set_default_cmap('Yale')
  • To access colormaps without setting them as default:

import matplotlib.pyplot as plt
import rahrah.cmap

plt.imshow(image, cmap = 'USC')

To reverse the colormap, simply append ‘_r’ to the name (e.g., ‘USC’ becomes ‘USC_r’).

  • To access the colors in a color cycle/palette without setting a default:

from rahrah.palette import return_colors

return_colors('BrownBright')

All of the individual functions are detailed below.

rahrah.palette.list_palettes(mincolors=False, maptype=False, verbose=False)

List all available palettes by name. Optionally filter for color cycle and colormap properties.

Parameters:
  • mincolors (int) – Minimum number of colors in color cycle. Use this to filter the available palettes. Default is no minimum.

  • maptype (str) – Either “sequential” or “diverging”. Use this to filter the available palettes. Default is no preference for colormap type.

  • verbose (bool) – Default is False. Enables printing of additional information.

Returns:

The list of available palettes (that match search criteria).

rahrah.palette.return_colors(palette)

Return colors in a particular palette’s color cycle.

Parameters:

palette (str) – Name of palette.

rahrah.palette.set_default(palette, verbose=False, reverse_cmap=False)

Set palette as default colormap and color cycle.

Parameters:
  • palette (str) – Name of palette to set as default.

  • verbose (bool) – Default is False. Enables printing of additional information about the color cycle.

  • reverse_cmap (bool/str) – Default is False. To reverse the colormap, use the keyword argument reverse_cmap = True or just use a string – e.g., set_default(‘LondonCalling’, ‘reverse’).

rahrah.palette.set_default_ccycle(palette, verbose=False)

Set palette as default color cycle.

Parameters:
  • palette (str) – Name of palette to set as default.

  • verbose (bool) – Default is False. Enables printing of additional information about the color cycle.

rahrah.palette.set_default_cmap(palette, reverse_cmap=False)

Set palette as default colormap.

Parameters:
  • palette (str) – Name of palette to set as default.

  • reverse_cmap (bool/str) – Default is False. To reverse the colormap, use the keyword argument reverse_cmap = True or just use a string – e.g., set_default(‘LondonCalling’, ‘reverse’).

rahrah.cmap.get_map(name, reverse_cmap=False)

Access colormaps.

Parameters:
  • name (str) – Name of colormap.

  • reverse_cmap (str) – Default is False.

rahrah.cmap.list_maps()

List all available colormaps by name.

rahrah.cmap.register_all()

Register all of the colormaps.