1

I have a large amount of measured data, that I would like to plot. Data are organized into three columns where the first column provides a frequency, the second and third column are values measured at this frequency, like this:

1000019.25  0.007299716 -0.46983397
746474.438  0.004848992 -0.33711791
557226.438  0.005053654 -0.244117826

I would like to plot column three over column two in my plot.

After every 64 rows, a new set of data starts which should be plotted in another graph in the same diagram.

I found the "select coords between"-option, but am only receiving an empty plot. Here's my example:

\begin{tikzpicture}

\pgfplotsset{select coords between index/.style 2 args={
    x filter/.code={
        \ifnum\coordindex<#1\def\pgfmathresult{}\fi
        \ifnum\coordindex>#2\def\pgfmathresult{}\fi
    }
}}

\begin{axis}[
]
\pgfplotstableread{pictures/data.txt} \datatable
\addplot table [x index = 1 , y index = 2, select coords between index={0}{63}] from \datatable;


\end{axis}

\end{tikzpicture}

This works so far if I manually select the lines. However, I was wondering if there is a way to add some kind of loop that automatically takes the first n rows for the first graph, the next n rows for the second etc. and also iterates the legend entries.

nmy2015
  • 515
  • 1
    I can't reproduce this: I get the correct plot when I create a dummy data table. Could you turn your code snippet into a complete minimal example document (starting from \documentclass, and including enough example data to reproduce the problem)? – Jake Oct 14 '15 at 21:51
  • Probably you are plotting a log y axis and you have negative numbers on col 3 for which log is not defined. – percusse Oct 14 '15 at 22:04
  • For a strange reason after re-compiling the above example really seems to work. But the solution I was looking for anyway was, how to automatically plot each 64 values into a new graph with a new legend entry. Is there something like a for-loop for this available? – nmy2015 Oct 15 '15 at 09:46
  • Probably neither Jake nor percusse saw your comment, their not notified unless you write @<username> If you're still wondering about that, please edit your question to concern the looping. – Torbjørn T. Nov 07 '15 at 22:05

0 Answers0