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 ?
\documentclass{minimal}
\usepackage{tikz}
\usepackage{pgfplots}
\usepgfplotslibrary{groupplots}
\usepackage{pgfplotstable}
\definecolor{skyblue1}{rgb}{0.447,0.624,0.812}
\pgfplotstableread{
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
}\modelresponses
\pgfplotstablegetcolsof{\modelresponses}
\begin{document}
\begin{tikzpicture}
\begin{groupplot}[group style={group size=3 by 2,vertical sep= 1.5cm},width=0.45\textwidth,ybar]
\pgfplotsinvokeforeach{1,2,3,4,5,6,7,8,9}{%
\pgfplotstablegetcolumnnamebyindex{#1}\of{\modelresponses}\to{\mycolname};
\nextgroupplot[title=\mycolname,grid=major];
\addplot[very thick,smooth,skyblue1] table [ x index=0, y index=#1] {\modelresponses};
}
\end{groupplot}
\end{tikzpicture}
\end{document}
title=$\mycolname$. – percusse Jun 07 '12 at 14:17=)– Jake Jun 07 '12 at 14:23