I have a pgfplot (which works fine), but I want to automatically load the data from a file: data.dat:
( 0 , 0.295027 )
( 1 , 0.295027 )
( 2 , 0.25965 )
( 3 , 0.219873 )
( 4 , 0.197843 )
( 5 , 0.18409 )
( 9582 , 0.0392299 )
( 9583 , 0.0392299 )
( 9941 , 0.0392299 )
( 9942 , 0.0392299 )
( 10250 , 0.0392299 )
( 10987 , 0.0392299 )
( 10988 , 0.0392299 )
( 10989 , 0.0392299 )
( 10990 , 0.0392299 )
( 10991 , 0.0392299 )
( 10992 , 0.0392299 )
( 10993 , 0.0392299 )
( 10994 , 0.0392299 )
I've been searching around and I found posts on how to read in csv file (addplot table [x=a, y=c, col sep=comma] {data.csv};), but I can't figure out how to do it with this format (a,b):
\documentclass[varwidth]{standalone}[2011/12/21]
\usepackage{pgfplots}
\pgfplotsset{compat=1.3}
\usepackage{etex}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{fancybox}
\usepackage{float}
\usepackage{setspace}
\begin{document}
\begin{tikzpicture}[scale=0.8]
\begin{axis}[
axis x line=bottom,
axis y line=left,
xlabel=Number of moves,
xmode=log,log basis x=10,
xmax = 500,
ymin = 1.3]
\addplot[dotted] coordinates {
(1,1.7)
(500,1.7)
};
\addplot[solid, gray] coordinates {
( 0 , 3.9259 )
( 1 , 3.9259 )
( 2 , 3.52535 )
( 10994 , 1.62303 )
};
\end{axis}
\begin{axis}[
axis x line=bottom,
axis y line=right,
xmax = 500,
ymin = 0.01,
% ymax = 0.25,
xmode=log,log basis x=10,
% xlabel=Number of moves,
%legend columns=1,
%legend entries={$f^a(s)$;, $f(s)$;, $f(s_\text{best})$},
%legend to name=named,
ylabel=DI]
% legend pos= north west]
\addplot[dashed] coordinates {
( 0 , 0.295027 )
( 1 , 0.295027 )
( 2 , 0.25965 )
( 3 , 0.219873 )
( 4 , 0.197843 )
( 5 , 0.18409 )
( 9582 , 0.0392299 )
( 9583 , 0.0392299 )
( 9941 , 0.0392299 )
( 9942 , 0.0392299 )
( 10250 , 0.0392299 )
( 10987 , 0.0392299 )
( 10988 , 0.0392299 )
( 10989 , 0.0392299 )
( 10990 , 0.0392299 )
( 10991 , 0.0392299 )
( 10992 , 0.0392299 )
( 10993 , 0.0392299 )
( 10994 , 0.0392299 )
};
\end{axis}
\end{tikzpicture}
\end{document}
,
by\t
.