about 1 month ago
A small library for generating color brewer color palettes. For more information on color brewer, see http://colorbrewer2.org/.
The color brewer palette collection was originally designed for maps, but is also useful for quickly generating nice colors for any kind of plot.
This package is now registered. Add it with
You can also add it with
The module contains one function,
palette, which takes a scheme name and an integer for the number of colors in the palette.
It returns an array of
RGB values, which are defined in the ColorTypes.jl package.
For example, to obtain a five color sequential green scheme, call
using ColorBrewer greens = palette("Greens", 5);
Pretty simple stuff.
It can drop right into Gadfly plots.
using Gadfly p = plot([x -> sin(n*x) for n in 1:3], 0, 25, Scale.color_discrete_manual(greens[3:5]...))
palette function is passed an invalid scheme or number of colors, it throws an
The schemes are broken up into three categories based on the type of data you want to show: sequential, diverging, and qualitative.
All sequential color schemes can have between 3 and 9 colors. The available sequential color schemes are:
All diverging color schemes can have between 3 and 11 colors. The available diverging color schemes are:
The number of colors a qualitative color scheme can have depends on the scheme. The available qualitative color schemes are:
Set3 schemes can have between 3 and 12 colors.
Set1 schemes can have between 3 and 9 colors.
Pastel2 schemes can have between 3 and 8 colors.
Huge thanks to ikirill for providing the color scheme previews!