When I have multiple line plots in pgfplots, the colors of the lines cycle through a few colors (my guess is the colors are blue, red, black and dark khaki) before repeating with different marks. See below:

enter image description here

However, in my opinion these default colors are not very nice. For example, compare the colors used by Color Brewer for qualitative data.

Based on the following link, I know enough about how to define my own line color styles in pgfplots. For example,

\definecolor{s1}{RGB}{228, 26, 28}
\definecolor{s2}{RGB}{55, 126, 184}
\definecolor{s3}{RGB}{77, 175, 74}
\definecolor{s4}{RGB}{152, 78, 163}
\definecolor{s5}{RGB}{255, 127, 0}
    s1,every mark/.append style={fill=s1},mark=*\\
    s2,every mark/.append style={fill=s2},mark=*\\
    s3,every mark/.append style={fill=s3},mark=*\\
    s4,every mark/.append style={fill=s4},mark=*\\
    s5,every mark/.append style={fill=s5},mark=*\\

Before defining my own color schemes, I was wondering if someone had already done this as a LaTeX/pgfplots package? If not, would this be a useful feature that could be incorporated in a future version of pgfplots?

  • 3
    There are already a couple of different cycle lists in PGFPlots (try cycle list name=exotic, or color list). I've also used the ColorBrewer "Blues" scheme in one answer, "Accent" in another, and "YellowGreenBlue" in yet another. I think it would be nice to have these pre-packaged, but keep in mind that the schemes are made for maps, not... – Jake Jun 14 '13 at 13:14
  • 3
    ... line plots, so a lot of the schemes (especially the diverging and sequential ones) don't work particularly well for line plots because they contain very light colours. Some adjustments might be necessary to make this work properly. – Jake Jun 14 '13 at 13:15
  • What you want to have sounds a lot like continuos color maps, something that pgfplots supports for colored plots. In principle, it should be possible to define suitable color maps and to retrieve color values in order to prepare cycle lists (compare tex.stackexchange.com/questions/44868/…) – Christian Feuersänger Jun 15 '13 at 8:37

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>.



    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};


Here's an overview of the color schemes:

  • This is great! I would like to accept your answer, but am not sure whether I should wait for someone (perhaps yourself) to provide a full answer? – I Like to Code Jun 14 '13 at 22:43
  • 1
    @ILiketoCode: I've uploaded a PGFPlots library file to the "From Answers to Packages" repository that can be used to create cycle lists now. Next step is creating colormaps. – Jake Jun 19 '13 at 2:27
  • 2
    @Jake: This is beautiful! I'm using it now for my MSc thesis. Thank you! I can't wait for the colormaps. – sudosensei Aug 1 '13 at 10:34
  • 6
    Jake's answer was not working for me. Neither on ShareLatex nor my local TexLive distribution. On both I would get the error message "I do not know the key /tikz/colorbrewer cycle list". I have to add \pgfplotsset{cycle list/Dark2} in the preample, and not use colorbrewer cycle list. – Roald Sep 21 '16 at 14:29
  • @Roald 's suggestion works, but it doesn't provide markers for the data points. For this you should refer to the manual as suggested by Stefan below, in particular the cycle multiindex* list setting. – Marijn Mar 27 '18 at 13:34

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.


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:

image showing the "Sequential Schemes" of the ColorBrewer library

image showing the "Diverging Schemes" of the ColorBrewer library

image showing the "Qualitative Schemes" of the ColorBrewer library

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.