I noticed that when using pgfplots to make plots without specifying style, it automatically assigns the same color and line style to the first input and fifth input, which means the two curves would have the same style...

Any way to avoid that?


While the first and fifth plot have the same line colour, the marks are different. However, this might not be enough distinction for your application, e.g. if you don't use markers.

In that case, you can choose from one of the other cycle list names, which are described in section 4.7.7 starting on p. 213 of the current pgfplots documentation (v1.16).

For example, if you set the option cycle list name=exotic for the axis, the first five plots would look like this:

pgpflots with "exotic" cycle list

You can also define your own cycle lists, using

{<first style>},
{<second style>},

Here's an example of a plot style based on the color scheme "Blues" from the Colorbrewer website. For the fifth plot, the color is overridden using the optional argument to \addplot:

plot with custom cycle list


\definecolor{blues1}{RGB}{198, 219, 239}
\definecolor{blues2}{RGB}{158, 202, 225}
\definecolor{blues3}{RGB}{107, 174, 214}
\definecolor{blues4}{RGB}{49, 130, 189}
\definecolor{blues5}{RGB}{8, 81, 156}


    cycle list name=colorbrewer-blues,
    no markers,
    every axis plot/.append style=thick]
\addplot {rnd*.5-.25};
\addplot {rnd*.5-0.5};
\addplot {rnd*.5-0.75};
\addplot+[orange,very thick]{rnd*.5+x*0.05-0.75};

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.