I have a long CSV data file:


I use pgfplots to plot all the lines. I also want to add mark shapes. But the problem is that the data is too dense, and I have a limited space, so the marks stick together.

I tried:

 \addplot[blue, thin, mark=square, each nth point=20] table ...

But it also skipped the data points.

I want to have a smooth line, but only a few marks. How can I do that?

  • You need mark repeat key sya mark repeat=10 will repeat marks once in ten. – user11232 Apr 21 '15 at 4:11

You need to use mark repeat key to repeat marks at frequent intervals. mark phase will tell at which point the marks should start. For example,

make repeat = r,
mark phase = p

will put the mark first at pth point and then at p+r th and then p+2rth point etc. An example from the manual

\begin{axis}[title=Without \texttt{mark repeat}]
\addplot+[scatter,samples=100] {sin(deg(x))};
\begin{axis}[title= With \texttt{mark repeat=5,mark phase=7}]
mark repeat=5,mark phase=7]

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.