TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For some application I generate a bunch of plots automatically from a script, that means that sometimes I issue contradictory options to pgfplots objects because one is the default (within the script), for example

\addplot[red, ...bla..., blue]{ ... }
\addplot[mark=*, ...bla..., mark=+]{ ... }

Fortunately, pgfplots overwrites previous settings in order. In this occasion however, the default is "only marks" (which makes the plot not to have joining lines), what would be option to overwrite "only marks"?

For example

\addplot[only marks, ...bla..., draw_lines_please]{ ... }

and makes the plot actually have joining lines by overwriting the first "only marks". (draw_lines_please replaces the option that I am looking for). (If there is one) What is the name of such option?

(I guess the question also applies in the case where only marks is the global pgfplots option, but the question is specific for the case above)

share|improve this question
This overriding property of the options does not apply to all possible keys. You can use the no markers option to get only the curves however it seems that only marks wins over it. Try for example \begin{tikzpicture} \begin{axis} \addplot+[no markers] {sin(deg(x))}; \end{axis} \end{tikzpicture} with and without only marks – percusse Mar 27 '12 at 7:25
Yes. But "no markers" is not the opposite to "only marks", the opposite to "only marks" has nothing to do with markers but it is something that positively says to draw lines between points (whether the points are visible or not). – alfC Mar 27 '12 at 7:35
up vote 18 down vote accepted

To reactivate drawing lines between the coordinates, use the key sharp plot (which is the standard plot type):

enter image description here


    legend entries={only marks,{only marks, sharp plot}},
    legend pos=outer north east,
\addplot [cyan, only marks] {rnd};
\addplot [orange, only marks, sharp plot] {rnd};
share|improve this answer
great, it is documented in section "5.2.1 Linear Plots", easy to find once you know what to look for. – alfC Mar 27 '12 at 8:02

Your Answer


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.