Difference between revisions of "Pgfplot"
From HCL
(One intermediate revision by the same user not shown) | |||
Line 16: | Line 16: | ||
<source lang="latex"> | <source lang="latex"> | ||
\begin{tikzpicture}[transform shape,scale=0.9] | \begin{tikzpicture}[transform shape,scale=0.9] | ||
− | \begin{axis}[ ylabel | + | \begin{axis}[ |
− | style={yshift=-15pt},width=\textwidth,height=7.4cm, | + | ylabel style={yshift=-15pt}, % place of the ylabel |
− | xlabel=Number of processors, | + | width=\textwidth,height=7.4cm, %size of the picture |
− | ylabel=Execution time ($10^3$ s),legend | + | xlabel=Number of processors, |
− | style={at={(.9,.9)}},ymin=0,ymax=8.8,mark size=1.5 | + | ylabel=Execution time ($10^3$ s), |
− | % | + | legend style={at={(.9,.9)}}, % place of the legend |
− | + | ymin=0, ymax=8.8, % range for the y axe | |
− | + | mark size=1.5 % size of the points | |
− | \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,y | + | \addplot+[] table[header=false,x index=0,y expr=\thisrowno{2}/1000]{data}; |
− | 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, | + | |
\legend{WSCOM$_{\text{pf}}$,WSCOM,list\_min}; | \legend{WSCOM$_{\text{pf}}$,WSCOM,list\_min}; | ||
\end{axis}\end{tikzpicture} | \end{axis}\end{tikzpicture} | ||
+ | |||
</source> | </source> | ||
Latest revision as of 11:53, 9 May 2012
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}, % place of the ylabel
width=\textwidth,height=7.4cm, %size of the picture
xlabel=Number of processors,
ylabel=Execution time ($10^3$ s),
legend style={at={(.9,.9)}}, % place of the legend
ymin=0, ymax=8.8, % range for the y axe
mark size=1.5 % size of the points
]
\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,y expr=\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