Thursday, 15 August 2013

Different marker at specific intervals using pgfplots

Different marker at specific intervals using pgfplots

I have a number of large data files with x rows in the range of 0 to z. Is
there an easy way to set a different marker at specific intervals using
pgfplots/TikZ? How can I produce a figure such that the marker for the
plot at intervals 0, 10, 20, ..., z is for example a cross but a circle
for the rest of the points?
Here's a MWE that can get you started:
\documentclass{article}
\usepackage{tikz,pgfplots}
\pgfplotsset{compat=1.8}
\begin{filecontents*}{thePlot.dat}
x y
0 20.44
1 20.06
2 19.76
3 19.54
4 19.40
5 19.34
6 19.36
7 19.46
8 19.64
9 19.90
10 20.24
\end{filecontents*}
\begin{document}
\begin{figure}[]
\centering
\begin{tikzpicture}
\begin{axis}[
xlabel={$x$},
ylabel={$y$},]
\addplot+[only marks,mark=x]
table[x=x,y=y] {thePlot.dat};
\end{axis}
\end{tikzpicture}%
\caption{The caption.}
\end{figure}
\end{document}

No comments:

Post a Comment