1

Is there a way to plot only the first n-th lines of a data file using pgfplots?

Currently I'm plotting the whole csv-file using (MWE):

\documentclass{article}

\usepackage{pgfplots}
\pgfplotsset{compat=1.11}

\begin{document}

\begin{tikzpicture}
    \pgfplotsset{}
    \begin{axis}
        \addplot+[mark = none] table[col sep = semicolon, x index = 1, y index = 2]{data.csv};
    \end{axis}

\end{tikzpicture}

\end{document}

whereas data.csv is as follows:

0;0;0;1;1
0.01;10;0.0905176;0.983244;0.928149
0.02;20;0.142047;0.973638;0.938638
0.03;30;0.178988;0.966722;0.938958
0.04;40;0.208729;0.961136;0.937353
0.05;50;0.234025;0.956371;0.935212
0.06;60;0.256216;0.952181;0.932922
0.07;70;0.276083;0.948423;0.930621
0.08;80;0.294132;0.945001;0.928367
0.09;90;0.310716;0.941853;0.926181
0.1;100;0.326089;0.938929;0.924071
0.11;110;0.340442;0.936195;0.922037
0.12;120;0.353923;0.933624;0.920079
0.13;130;0.366646;0.931194;0.918191
0.14;140;0.378706;0.928888;0.916371
0.15;150;0.390177;0.926692;0.914613
0.16;160;0.401124;0.924594;0.912914
0.17;170;0.411598;0.922585;0.911271
0.18;180;0.421644;0.920656;0.909679
0.19;190;0.4313;0.918799;0.908135
0.2;200;0.4406;0.91701;0.906636
0.21;210;0.449573;0.915282;0.90518
0.22;220;0.458243;0.91361;0.903764
0.23;230;0.466632;0.911992;0.902385
0.24;240;0.474761;0.910422;0.901042
0.25;250;0.482647;0.908898;0.899733
0.26;260;0.490306;0.907417;0.898456
0.27;270;0.497752;0.905976;0.897209
0.28;280;0.504997;0.904572;0.89599
0.29;290;0.512054;0.903205;0.894799
0.3;300;0.518932;0.90187;0.893633

How to plot only the first n-th lines of the given data table? Let's say the first 10 lines for the sake of convenience.

albert
  • 937

0 Answers0