23

So using \addplot+ gives specific points on my curve vs \addplot which just gives me a curve? How does \addplot+ select the points it graphs etc?

4
  • 10
    When you use \addplot, the default styles are over written. When \addplot+ the changes we make are appended not replaced.
    – user11232
    Commented Nov 1, 2015 at 5:26
  • @harish: sounds like an answer, my friend :)
    – cmhughes
    Commented Nov 1, 2015 at 9:01
  • @cmhughes Hi Chris, Long time...... :-) Looks like you are busy. :). Answer added. Thanks.
    – user11232
    Commented Nov 1, 2015 at 10:25
  • It uses /.style or /.append style handlers depending on the + sign
    – percusse
    Commented Nov 2, 2015 at 11:00

1 Answer 1

17

The answer for your question lies in section 3.3.2, page 24, of pgfplots manual:

enter image description here

So, to be brief, When you add many \addplot lines inside the axis environment like:

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.12}
\begin{document}
  \begin{tikzpicture}
    \begin{axis}
      \addplot {x};
      \addplot {x-1};
      \addplot {x-2};
      \addplot {x-3};
      \addplot {x-4};
    \end{axis}
  \end{tikzpicture}
\end{document}

Every \addplot directive receives a pre-defined style (line color, marker style etc) through a pre-defined cycle list that is automatically chosen depending on the index of the current \addplot instruction. If you want to add some of your styles manually (like I want red colour instead of blue, say), you can add them through options to \addplot like \addplot[<your options>]. Now the question is whether you want your own style (your options) to be appended to or replace one of these cycle lists assigned. This is decided by the + sign. If you use \addplot+ [<your options>], your style is appended to and by \addplot[<your options>] , your options will replace the assigned cycle list.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .