Is it possible to make a pgfplotstable smaller? Reduce spaces and maybe draw vertical lines between columns?

Here you have two issues:

  1. your table is too long to fit in one page
  2. it is also too wide

For the first problem, you can fix this by using the longtable package (alone or with the tabu package as longtabu) by adding

\usepackage{longtable}
\usepackage{tabu} % if you want

to your preamble, and adding the following table definition to the \pgfplotstabletypeset:

\pgfplotstableset{
   begin table=\begin{longtable},
   end table=\end{longtable},
}

or

\pgfplotstableset{
   begin table=\begin{longtabu},
   end table=\end{longtabu},
}

for the second problem, you can either change the font size by including your pfgtable into a block {} and issuing a \small or equivalent, or using the graphicx package and scale the table width to \linewidth with

\resizebox{\linewidth}{!}{\pgfplotstabletypeset[...]
   {...}
}

EDIT

Following the comment by @polar, indeed, longtable and therefore longtabu cannot be fit into a resize box. (Sorry about that I had not thought hard enough).

However using longtabu functionality, we can get the table to fit albeit with the help of some font resizing:

\pgfplotstabletypeset[
    font={\small},
    begin table=\begin{longtabu} to \linewidth {@{}ccc*6{X[c]}@{}},
    end table=\end{longtabu},
    skip coltypes=true,
    every head row/.style={
    ...

using the following code will produce a table that fits width the margins (commenting the font line one a default article class at default font size give a overfull hbox of .6something pt.

To explain the crypting column definition if you are not aware of tabu's syntax

  • @{} gets rid of the space at the beginning and the end of the row (not tabu specific)
  • c is your normal centred column
  • *6{} defines 6 columns width the included definition
  • X[c] defines a stretchable column to help fit the table to the desired width as specified with the to \linewidth command

Additionally you need the skip coltypes=false, line as otherwise pgfplotstable adds the default {ccccccccc} definition.

Giving you:

enter image description here


ArTourter's anwer was accepted, but for anyone who comes here and think that is too complicated or long, I have adapted his first solution, the resizebox one, that doesn't work with pgfplotstable, but does work with latex's tabular:

\documentclass{standalone}
\usepackage{booktabs}
\usepackage{pgfplotstable}
\usepackage{graphicx}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\begin{document}



\resizebox{\linewidth}{!} {
\begin{tabular}{cccccccc}
\hline
 & & \multicolumn{2}{c}{32-2} & \multicolumn{2}{c}{128-4} & \multicolumn{2}{c}{256-8} \\
\cmidrule(r){3-4} \cmidrule(r){5-6} \cmidrule(r){7-8}
\begin{tabular}{l}Nome do conjunto\\de problemas\end{tabular} & \begin{tabular}{l}Número de\\problemas\end{tabular} & \begin{tabular}{l}Tempo médio \\de execução\end{tabular} & \begin{tabular}{l}Qualidade média\\das soluções\end{tabular} & \begin{tabular}{l}Tempo médio\\de execução\end{tabular} & \begin{tabular}{l}Qualidade média\\das soluções\end{tabular} & \begin{tabular}{l}Tempo médio \\de execução\end{tabular} & \begin{tabular}{l}Qualidade média\\das soluções\end{tabular} \\
\midrule
HP & 2 & 1,9829 & 0,9658 & 3,2232 & 0,9663 & 4,4793 & 0,9769 \\
PB & 6 & 1,9262 & 0,9652 & 3,0170 & 0,9668 & 4,2623 & 0,9719 \\
PETERSEN & 7 &1,8596 & 0,9939 & 3,0998 & 0,9935 & 4,5300 & 0,9949 \\
SENTO &  2 &4,8483 & 0,9930 & 9,5959 & 0,9924 & 14,5512 & 0,9936 \\
WEING  &  8 &2,5777 & 0,9991 & 6,3547 & 0,9997 & 9,4898 & 0,9999 \\
WEISH &  30 & 2,8594 & 0,9905 & 5,9862 & 0,9883 & 9,2029 & 0,9898 \\
\bottomrule
\end{tabular}
}

}
    \end{document}

Output:

output

Since I made the table a lot shorter, I don't need to use the longtable anymore, but if your table is long, use it like ArTourter suggested.