Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 19 down vote accepted

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 starting on p. 142 of the pgfplots documentation.

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

\pgfplotscreateplotcyclelist{<name>}{
{<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

\documentclass{article}
\usepackage{pgfplots}

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

\pgfplotscreateplotcyclelist{colorbrewer-blues}{
{blues1},
{blues2},
{blues3},
{blues4},
{blues5},
}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
    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{rnd*.5-1};
\addplot+[orange,very thick]{rnd*.5+x*0.05-0.75};
\end{axis}
\end{tikzpicture}
\end{document}
share|improve this answer
    
my bad it's pretty obvious in the documentation, I just didn't find it. –  ben paillard Aug 19 '11 at 12:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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