TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to plot some data using loops, but i've some issues when I try to extract the column header and have it as a sub legend. Does anyone have any idea to fix it up ?



time    y   c   q   r   pi  r_F efp z_E z_F
1   0.105597    0.000553    0.007493    0.002008    0.001352    41.251213   0.015177    0.015177    41.251213
2   0.003563    0.003143    -0.001881   0.000742    -0.000582   0.541130    -0.011564   -0.001644   0.545364
3   0.003204    0.004251    -0.000223   0.000048    -0.000367   -0.016199   0.000767    0.001246    -0.016337
4   0.003582    0.004518    0.000531    -0.000285   -0.000218   -0.115549   0.000642    0.000411    -0.115694
5   0.003762    0.004358    0.000743    -0.000414   -0.000126   -0.158629   0.000492    -0.000035   -0.158753


    \begin{groupplot}[group style={group size=3 by 2,vertical sep= 1.5cm},width=0.45\textwidth,ybar]
             \addplot[very thick,smooth,skyblue1] table [ x index=0,  y index=#1] {\modelresponses};
share|improve this question
Just to make your example compilable, replace the group title key with title=$\mycolname$. – percusse Jun 7 '12 at 14:17
@percusse: I believe that's the answer to the question =) – Jake Jun 7 '12 at 14:23
@percusse found the solution. It's now working, thanks a lot. – gVermandel Jun 7 '12 at 14:44
up vote 3 down vote accepted

The underscores require the math mode. Hence a quick fix is to put the title variable between dollar signs i.e. replacing the respective line with


However, just for the sake of curiosity it would be nice if someone can find a way to pass the title names including math characters like \pi,\psi without expanding (as I suspect it is the problem).

share|improve this answer
Christian Feuersänger showed a way how to do this in How can LaTeX code in a data file be read by pgfplotstable?: You define a macro \let\ESCAPE=\string at the start of the file, change the column name in the datafile to {\ESCAPE\pi}, and use title=\let\ESCAPE\relax$\mycolname$. – Jake Jun 7 '12 at 15:39
@jake Aha nice. Thanks for the pointer. – percusse Jun 7 '12 at 15:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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