\pgfplotstable in latex

  \pgfplotstable  package generates numeric table in latex pdf by getting input from .dat file. Basically this package is preinstalled. But if not, Install it from synaptic manager under Linux.

Create demoplot.tex

\documentclass{article}
 \usepackage{pgfplotstable}
 \usepackage{booktabs}
 \begin{document}
 \begin{table}[h!]\centering
      \pgfplotstableset{% global config, for example in the preamble
       % these columns/<colname>/.style={<options>} things define a style
       % which applies to <colname> only.
       every head row/.style={before row=\toprule,after row=\midrule},
       every last row/.style={after row=\bottomrule}
       }
      \pgfplotstabletypeset[% local config, applies only for this table
      1000 sep={\,},
      columns/info/.style={
      fixed,fixed zerofill,precision=2,showpos,
      column type=r,
       }
      ]
 {example1.dat}
 \caption{Estimated Data.}
 \end{table}
 \end{document}

create input file : example1.dat

level    dof    error1    error2    info    grad(log(dof),log(error1))
 1    4    2.50000000e-01    7.57858283e-01    48    0    0
 2    15    6.2300000e-02    5.00000000e-01    25    -1.35691545e+00
 3    81    1.56250000e-02    2.87124589e-01    41    -1.17924958e+00
 4    289    3.90625000e-03    1.43587294e-01    8    -1.08987331e+00
 5    1089    9.36562500e-04    4.41941738e-02    22    -1.04500712e+00
 6    4425    2.44140625e-04    1.69102322e-02    46    -1.02252239e+00
 7    19041    6.10351562e-05    8.20091159e-03    40    -1.01126607e+00
 8    63349    1.52587891e-05    3.90625000e-03    48    -1.00563427e+00

Run:

$ pdfltaex demplot.tex

Output:

pgfplot

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s