# Change color of plots in pgfplots globally

In pgfplots I can change the color of plots locally as in the example below. However is there a way to change the color for all plots in a document globally?

\documentclass{article}

\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
\begin{axis}
\end{axis}
\end{tikzpicture}
\end{document}

-

EDIT:

The following comment of Christian Feuersänger must regard

The solution is correct - but every axis plot post will append the options to every single plot. In case you want one plot to be (say) green, you would need to clear every axis plot post first

You can set this via every axis plot post

\documentclass{standalone}

\usepackage{pgfplots}
\pgfplotsset{%
every axis plot post/.append style={red,mark=none}}

\begin{document}
\begin{tikzpicture}
\begin{axis}
\end{axis}
\end{tikzpicture}
\end{document}


In the pgfplots manual at page 236 you will find more settings. For example every axis plot no

-
The solution is correct - but every axis plot post will append the options to every single plot. In case you want one plot to be (say) green, you would need to clear every axis plot post first. –  Christian Feuersänger Dec 29 '11 at 14:13
@ChristianFeuersänger: Thanks for the information. –  Marco Daniel Dec 29 '11 at 14:21
@ChristianFeuersänger: I used your comment ;-) –  Marco Daniel Dec 29 '11 at 14:23

A good approach is to define your own "cycle list".

The cycle list controls which colors are assigned unless your explicitly overrule the cycle list:

\documentclass{article}

\usepackage{pgfplots}

\pgfplotsset{
cycle list={red\\yellow\\green\\},
}

\begin{document}

\begin{tikzpicture}
\begin{axis}
\end{axis}
\end{tikzpicture}

\end{document}


Here, the first plot has no arguments and uses the first entry of the current cycle list (which is red). The second plot uses the second entry of the cycle list (which is yellow).

This allows to define a global set of colors.

If the global cycle list contains only one entry, all plots will use this entry.

At the same time, you can still overrule color definitions by writing \addplot[<customized>] (which will ignore the cycle list entry) or \addplot+[<customized>] which will still use the cycle list, but it will append the customized options.

-