Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I use the following command to plot data from a file using pgfplots.

\addplot table [x expr=\coordindex+1,y index=0]{file.txt}

I have around 8 curves in the same plot and lot of data points in the files that when I plot the graph, the graph is very thick and the different curves cannot be distinguished from each other. As a solution, how to make the marker appear only on every n points?

share|improve this question

1 Answer 1

up vote 7 down vote accepted

You can use mark repeat={<integer>}, where the positive <integer> causes to draw only each n-th mark. A little example:

\begin{filecontents*}{mytable.dat}
dof L2
5   8.31160034e-02
17  2.54685628e-02
49  7.40715288e-03
69  2.10192154e-03
71  5.87352989e-04
92  1.62269942e-04
\end{filecontents*}
\documentclass{article}
\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
\begin{loglogaxis}[
xlabel=Dof,
ylabel=$L_2$ error]
\addplot table[x=dof,y=L2] {mytable.dat};
\end{loglogaxis}
\end{tikzpicture}

\begin{tikzpicture}
\begin{loglogaxis}[
xlabel=Dof,
ylabel=$L_2$ error,
mark repeat={2}]
\addplot table[x=dof,y=L2] {mytable.dat};
\end{loglogaxis}
\end{tikzpicture}

\end{document}

enter image description here

share|improve this answer

Your Answer

 
discard

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.