pgfplots line colors

You can use cycle list name=<list>. there are few pre-defined lists --

  1. color (from top to bottom)
  2. exotic
  3. black white
  4. mark list
  5. mark list*
  6. linestyles
  7. linestyles*
  8. auto

If you want you can create your own list like

\pgfplotscreateplotcyclelist{mycolorlist}{%
blue,every mark/.append style={fill=blue!80!black},mark=*\\%
red,every mark/.append style={fill=red!80!black},mark=square*\\%
brown!60!black,every mark/.append style={fill=brown!80!black},mark=otimes*\\%
black,mark=star\\%
blue,every mark/.append style={fill=blue!80!black},mark=diamond*\\%
red,densely dashed,every mark/.append style={solid,fill=red!80!black},mark=*\\%
brown!60!black,densely dashed,every mark/.append style={
solid,fill=brown!80!black},mark=square*\\%
black,densely dashed,every mark/.append style={solid,fill=gray},mark=otimes*\\%
blue,densely dashed,mark=star,every mark/.append style=solid\\%
red,densely dashed,every mark/.append style={solid,fill=red!80!black},mark=diamond*\\%
}

and use it as cycle list name=mylist.

Code (taken from pgfplots manual):

\documentclass{article}
\usepackage{pgfplots}
\begin{document}

\begin{tikzpicture}
\begin{axis}[
stack plots=y,stack dir=minus,
cycle list name=color list]
\addplot coordinates {(0,1) (0.5,1) (1,1)};
\addplot coordinates {(0,1) (0.5,1) (1,1)};
\addplot coordinates {(0,1) (0.5,1) (1,1)};
\addplot coordinates {(0,1) (0.5,1) (1,1)};
\addplot coordinates {(0,1) (0.5,1) (1,1)};
\addplot coordinates {(0,1) (0.5,1) (1,1)};
\addplot coordinates {(0,1) (0.5,1) (1,1)};
\addplot coordinates {(0,1) (0.5,1) (1,1)};
\addplot coordinates {(0,1) (0.5,1) (1,1)};
\addplot coordinates {(0,1) (0.5,1) (1,1)};
\addplot coordinates {(0,1) (0.5,1) (1,1)};
\addplot coordinates {(0,1) (0.5,1) (1,1)};
\addplot coordinates {(0,1) (0.5,1) (1,1)};
\end{axis}
\end{tikzpicture}
\end{document}

enter image description here


With the release of PGFPlots v1.13 it is much easier to define cycle lists, because now there exist much more possibilities. For example cycle lists can be combined from other cycle lists. With that you can define your "default" color cycle list and then combine it with others to fit certain requirements.

Here you can see an example using the cycle multiindex* list key. For more have a look at section 4.7.7 on page 194 of the PGFPlots manual.

\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
    \usetikzlibrary{
        pgfplots.colorbrewer,
    }
    \pgfplotsset{
        % define a `cycle list' for marker
        cycle list/.define={my marks}{
            every mark/.append style={solid,fill=\pgfkeysvalueof{/pgfplots/mark list fill}},mark=*\\
            every mark/.append style={solid,fill=\pgfkeysvalueof{/pgfplots/mark list fill}},mark=square*\\
            every mark/.append style={solid,fill=\pgfkeysvalueof{/pgfplots/mark list fill}},mark=triangle*\\
            every mark/.append style={solid,fill=\pgfkeysvalueof{/pgfplots/mark list fill}},mark=diamond*\\
        },
    }
\begin{document}
    \begin{tikzpicture}
        \begin{axis}[
            % load a color `cycle list' from the `colorbrewer' library
            cycle list/RdGy-6,
            % define fill color for the marker
            mark list fill={.!75!white},
            % create new `cycle list` from existing `cycle list's and an
            cycle multiindex* list={
                RdGy-6
                    \nextlist
                my marks
                    \nextlist
                [3 of]linestyles
                    \nextlist
                very thick
                    \nextlist
            },
            samples=3,
            legend entries={0,...,20},
            legend pos=outer north east,
        ]
            \addplot {x};
            \addplot {x-1};
            \addplot {x-2};
            \addplot {x-3};
            \addplot {x-4};
            \addplot {x-5};
            \addplot {x-6};
            \addplot {x-7};
            \addplot {x-8};
            \addplot {x-9};
            \addplot {x-10};
            \addplot {x-11};
        \end{axis}
    \end{tikzpicture}
\end{document}

image showing the result of above code

Tags:

Color

Pgfplots