I have a pretty straightforward line chart I want to make using PGFplotstableread. It seems that when I draw the lines, only the first Y is recognized.
\documentclass[11pt, twoside, a4paper]{report}
\usepackage{caption}
\usepackage{siunitx}
\usepackage{pgfplots}
\pgfplotsset{
compat=1.16,
% created a style for the common `axis' options
my axis style/.style={
width=\linewidth,
height=0.35\linewidth,
bar width=0.9,
enlarge x limits={abs=0.45}, % <-- changed to absolute coordinates
ymin=0,
legend style={
at={(0.5,1.05)}, % <-- adapted
anchor=south, % <-- changed from `north'
legend columns=2,
},
ylabel={PR\textsubscript{A}},
xtick=data,
axis lines*=left,
ymajorgrids,
%
table/x=x,
},}
\pgfplotstableread{%
x Floating_cSi_inner Floating_cSi_middle Floating_cSi_outer Reference_cSi_average Floating_cSi_average
20 27.7 28.3 26.4 25.7 27.5
21 35.9 35.8 34.1 33.2 35.3
22 35.7 34.5 31.5 35.6 33.9
23 30.5 28.6 25.0 31.0 28.0
24 30.9 29.3 25.9 29.6 28.7
25 31.8 30.3 25.8 28.7 29.3
26 38.2 37.6 34.5 34.4 36.7
27 39.5 38.2 34.3 36.3 37.3
28 35.5 34.7 29.9 34.7 33.3
29 39.3 37.6 32.1 36.9 36.3
}{\loadedtableweeklywatsp}
\begin{document}
\begin{figure}[h]
\begin{tikzpicture}
\begin{axis}[my axis style, ylabel = WAT (\degree C), xlabel = Week number]
\addplot [ultra thick, draw=red!50!black, smooth, y = Floating_cSi_inner] table {\loadedtableweeklywatsp};
\addplot [ultra thick, draw=blue!50!black, smooth, y = Floating_cSi_middle] table {\loadedtableweeklywatsp};
\addplot [ultra thick, draw=green!50!black, smooth, y = Floating_cSi_outer] table {\loadedtableweeklywatsp};
\end{axis}
\end{tikzpicture}
\label{fig:WAT_SP_float}
\caption{Weighted average temperatures for SunProjects floating cSi system }
\end{figure}
\end{document}
Output (should be three lines):


ycolumn at the wrong place. It does not belong to the\addplotoptions, but to thetableoptions. Thus, change\addplot [...,y=<column name>] table {...};to\addplot [...] table [y=<column name>] {...};and it will work. – Stefan Pinnow Aug 06 '18 at 06:41