3

I followed the standard way (to the extent of my knowledge) of accessing the column name in pgfplotstable but it doesn't seem to be working.

This is the code:

\begin{figure}[H]
\pgfplotstabletypeset[
    col sep=comma,
    string type,
    columns/name/.style={column name=$\epsilon$, column type={|c|}},
    columns/surname/.style={column name=$\phi$, column type={|c|}},
    every head row/.style={before row=\hline,after row=\hline},
    every last row/.style={after row=\hline},
    ]{test.csv}
\caption{Results}
\end{figure}

and this is what it generates: enter image description here

It is supposed to have \phi and \epsilon in there but it doesn't. This is what the data file test.csv contains

parameter,test
1,2
1,2
1,3

Thanks for the help.

  • Your column names are not name and surname but parameter and test. Where do you want \phi and \epsilon? – user11232 Aug 19 '14 at 23:18
  • Hi @HarishKumar , I need to replace parameter and test with \phi and \epsilon respectively. – kolonel Aug 19 '14 at 23:22
2

You have to use the proper header names of columns. Your columns have names parameter and test but you are using name and surname. Change them to

    columns/parameter/.style={column name=$\epsilon$, column type={|c|}},
    columns/test/.style={column name=$\phi$, column type={|c|}},

Code:

\documentclass{article}
\usepackage{pgfplotstable}
\pgfplotsset{compat=1.10}
\usepackage{filecontents}
\begin{filecontents*}{test.csv}
  parameter,test
    1,2
    1,2
    1,3
\end{filecontents*}
\begin{document}
  \begin{figure}[H]        %% why figure?
  \centering
\pgfplotstabletypeset[
    col sep=comma,
    string type,
    columns/parameter/.style={column name=$\epsilon$, column type={|c|}},
    columns/test/.style={column name=$\phi$, column type={c|}},
    every head row/.style={before row=\hline,after row=\hline},
    every last row/.style={after row=\hline},
    ]{test.csv}
\caption{Results}
\end{figure}
\end{document}

enter image description here

I have also corrected the second column type={c|} (for test).

  • Thank you for your help. Would you happen to know to center the caption below the table? also, I only get a "." after Figure1 instead of ":". So I am getting "Figure1." instead of "Figure1:", do you happen to know why? anyways thank you. – kolonel Aug 19 '14 at 23:55
  • @kolonel: I am not getting both of them. Hence it is hard to say without seeing your code. Have you put \centering as I did? Figure 1: is default. May you have changed something, may be with caption package? – user11232 Aug 19 '14 at 23:57
  • actually its okay. Thanks a lot for your help – kolonel Aug 20 '14 at 1:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.