# Get default colored plots with “no markers” command in pgfplots

I want to plot several curves with a \foreach command in pgfplots. I don't want any markers, and I can't find a way to get colored plots without markers in a \foreach loop. Using no markers gets rid of markers and colors.

\documentclass[12pt]{article}
\usepackage{pgfplots}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
\begin{axis}
\foreach \pas in {1,2,...,10}
{
}
\end{axis}
\end{tikzpicture}
\end{document}

-

If you just supply the option[mark=none], you reset the other options for the plot, resulting in black, solid lines. You should use a plus sign (\addplot +[mark=none] ...) to append the mark=none option while leaving the other options untouched.

\documentclass[12pt]{article}
\usepackage{pgfplots}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
\begin{axis}
\foreach \pas in {1,2,...,10}
{
}
\end{axis}
\end{tikzpicture}
\end{document}


Note that if you don't want any plot marks in any of your plots, you could also set the axis option no markers to switch the marks off for all plots.

\documentclass[12pt]{article}
\usepackage{pgfplots}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
\begin{axis}[no markers]
\foreach \pas in {1,2,...,10}
{
}
\end{axis}
\end{tikzpicture}
\end{document}

-
thanks Jake. I didn't find it in the manual. That makes complete sense ! –  ben paillard Aug 6 '11 at 10:02
Glad it helps! It's on p. 24 of the PGFplots manual. –  Jake Aug 6 '11 at 10:17

Although this solution works it is not recommended. See Jake's comment and solution instead).

If you use \pgfsetplotmarksize{0pt} then you still get the colored lines but the no mark. I am not sure why mark=none resulted in no colors.

\documentclass[12pt]{article}
\usepackage{pgfplots}
\usepackage{tikz}

\begin{document}{% begin group to keep settings local
\pgfsetplotmarksize{0pt}
\begin{tikzpicture}% no markers here
\begin{axis}
\foreach \pas in {1,2,...,10} {
}
\end{axis}
\end{tikzpicture}
}% end group
%
\begin{tikzpicture}% this will have markers
\begin{axis}
\foreach \pas in {1,2,...,10} {

I tried all those options as well, and perhaps some other experts can explain why they don't work, or if that is a bug. To have markers in other parts of your doc, you can either reset \pgfsetplotmarksize{}, or use grouping as the updated MWE shows. –  Peter Grill Aug 5 '11 at 18:42
This is not a bug, the behaviour is correct and documented in the manual. Just setting one option for a plot resets all other styles. If you want to append an option, use +[<option>]. I would suggest deleting this answer. –  Jake Aug 6 '11 at 2:02