I have a data file which contains all the experiments that have been conducted for different cases. Is it possible in pgfplots
to only read specific portion of the file and plot the results?
Let's say the data file, named mydata.dat
, looks like the following:
case var1 var2 var3
1 0.10 0.25 10.00
1 0.20 0.35 25.00
1 0.30 0.45 40.00
1 0.40 0.55 55.00
1 0.50 0.65 70.00
1 0.60 0.75 85.00
2 1.00 0.50 55.00
2 2.00 0.50 55.00
2 3.00 0.50 55.00
2 4.00 0.50 55.00
2 5.00 0.50 55.00
2 6.00 0.50 55.00
2 7.00 0.50 55.00
2 8.00 0.50 55.00
2 9.00 0.50 55.00
3 10.00 1.00 22.50
3 20.00 2.00 22.50
3 30.00 3.00 22.60
3 40.00 4.00 22.70
3 50.00 5.00 22.65
4 100.00 10.00 135.00
4 200.00 20.00 140.00
4 300.00 30.00 137.00
4 400.00 40.00 144.00
4 500.00 50.00 141.00
4 600.00 60.00 136.00
4 700.00 70.00 136.00
How can I read the file using pgfplot
and for example plot the data only for case=3
which are:
3 10.00 1.00 22.50
3 20.00 2.00 22.50
3 30.00 3.00 22.60
3 40.00 4.00 22.70
3 50.00 5.00 22.65
How can I modify the following code to be able to obtain the results I am looking for?
\documentclass[crop=true,border=2mm]{standalone}
\usepackage{pgfplots}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{graphicx}
\begin{document}
\begin{tikzpicture}
\begin{axis}[%
axis on top,
width = 4cm,
height = 4cm,
scale only axis,
]
\addplot
table [%
col sep=tab, %
x=var1, y=var2,] %
{mydata.dat};
\end{axis}
\end{tikzpicture}
\end{document}
var1
column here has ranges that suggest you could simple doxmax
/xmin
setting.