Pgfplot

From HCL
Revision as of 11:49, 9 May 2012 by Quintin (talk | contribs)

Jump to: navigation, search

PgfPlot is a package which let you do the same things as gnuplot but directly inside your latex file. And this has a lot of advantages:

- no additional file
- no conversion from eps or ps or png to the pdf
- the quality is really improved
- the picture text has the same font as the rest of the document

Preambule

\usepackage{tikz}
\usepackage{pgfplots}

example

\begin{tikzpicture}[transform shape,scale=0.9]
\begin{axis}[ ylabel
style={yshift=-15pt},width=\textwidth,height=7.4cm,
xlabel=Number of processors,
ylabel=Execution time ($10^3$ s),legend
style={at={(.9,.9)}},ymin=0,ymax=8.8,mark size=1.5]
\addplot+[] table[header=false,x index=0,y
expr=\thisrowno{2}/1000]{data};
\addplot+[] table[header=false,x index=0,y
expr=\thisrowno{2}/1000]{data};
\addplot+[] table[header=false,x index=0,yexpr=\thisrowno{2}/1000]{data};
\legend{WSCOM$_{\text{pf}}$,WSCOM,list\_min};

\end{axis}\end{tikzpicture}


a part of the file "data" is shown just after:


1  list_min 8241.04532500001 0.592721444672621 400
2  list_min 4276.264 0.541485563775196 400
3  list_min 2840.83145 0.240012784271948 400
4  list_min 2171.53825 0.204766932333766 400
5  list_min 1771.9397 0.187049380812677 400