Pre-defined color cycles à la RColorBrewer?
This is an edit of Stefan Pinnow:
Jake is referring to a non-PGFPlots/external colorbrewer library of (I guess LoopSpace). For the PGFPlots/internal colorbrewer library please have a look at my answer.
There is now a PGFPlots library colorbrewer
that creates cycle lists using the colorbrewer color schemes. The color values are taken from the ColorBrewer Excel file.
To set a colorbrewer cycle list, you call colorbrewer cycle list=<scheme>
, which will define the necessary colors (colorbrewer1
to colorbrewer8
) and create a cycle list called colorbrewer
.
The number of colors and plot styles that are defined can be set using the key colorbrewer values=<number>
.
\documentclass{article}
\usepackage{pgfplots}
\usepgfplotslibrary{colorbrewer}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
colorbrewer cycle list=Dark2
]
\addplot {rnd};
\addplot {rnd-1};
\addplot {rnd-2};
\addplot {rnd-3};
\addplot {rnd-4};
\addplot {rnd-5};
\addplot {rnd-6};
\addplot {rnd-7};
\end{axis}
\end{tikzpicture}
\end{document}
Here's an overview of the color schemes:
Just for the record
Since v1.13 PGFPlots provides the ColorBrewer color schemes itself in the corresponding library colorbrewer
. Because I don't want to repeat the manual I want to refer to it. It are only 4 pages to read and about two of them consist of images from what I'll repeat some of them here.
Edit
In the meantime I have answered several questions where I used the colorbrewer
library. Here are some of them you can study, if you don't want to read the manual or have some practical code to play with:
questions regarding
cycle list
s- colorbrewer with pgfplot 1.15
- colorbrewer cycle list not showing markers
- How can I reverse a cycle list in pgfplots?
- Plot a stacked bar plot with specialised x axis range
questions regarding
colormap
s- Diverging color scale for a table heatmap
- pgfplots - surf - Standard color schemes
- PGFPlots 3D: cannot use most of the colormaps for the interior colormap
- GIS layer maps from .dat files and not figures