\documentclass[tikz,border=5pt]{standalone}
\usepackage{colortbl}
\usepackage{pgfplotstable}
\usepackage{pgfplots}
\usepgfplotslibrary{groupplots}
\pgfplotsset{compat=1.15}
\pgfplotstableset{
every head row/.style={before row=\hline\rowcolor{gray!33}, after row=\hline},
every last row/.style={after row=\hline},
schemerow/.style={
every row no #1/.style={before row=\rowcolor{blue!44}},
},
firstrow/.style={
every row no #1/.style={before row=\rowcolor{red!44}},
},
}
\begin{document}
\newcounter{count}
\section{Data-Table}
\pgfplotstableread[]{
No. k
1 0.0
2 1.1
3 2.2
4 3.3
5 4.4
6 5.5
7 6.6
8 7.7
9 8.8
10 9.9
11 10.10
12 11.11
}\datatable
\pgfplotstablegetrowsof{\datatable}
\pgfmathsetmacro\datarows{\pgfplotsretval}
\pgfmathsetmacro\schemerows{int(floor(0.5*(sqrt(8*\datarows+1)-1)))}
\pgfmathsetmacro\schemeentries{int(\schemerows*(\schemerows+1)/2)}
\pgfmathsetmacro\schemeentriesno{\schemeentries-1}
\let\List=\empty
\foreach \n in {0,...,\schemerows}
{
\pgfmathparse{int(\n*(\n+3)/2)}
\ifx\empty\List{} \xdef\List{\pgfmathresult}
\else \xdef\List{\List,\pgfmathresult}
\fi
}
\pgfplotstabletypeset[string type,
every even row/.style={before row=\rowcolor{gray!33}},
every odd row/.style={before row=\rowcolor{gray!33}},
schemerow/.list={0,...,\schemeentriesno},
firstrow/.list/.expand once={\List},
]{\datatable}
\par Number of rows in datatable: \datarows; \par
has to be of the kind $1, 3, 6, 10, 15, 21, 28,\dots = \frac{n(n+1)}{2}$ for scheme. \par
Number of (possible) schemerows: \schemerows.
Info: {\schemeentries} entries in scheme. \par
\section{Help-Table}
\setcounter{count}{-1}
\def\helptablefilename{\jobname-helptable.txt}
\newwrite\helptableout
\immediate\openout\helptableout=\helptablefilename
\immediate\write\helptableout{row, col, filled, first, count}
\foreach \row in {1,...,\schemerows}{
\foreach \col in {1,...,\schemerows}{
\pgfmathsetmacro\filled{\col<=\row ? 1 : 0}
\pgfmathsetmacro\first{\col==\row ? 1 : 0}
\ifnum\filled=1 \stepcounter{count} \fi
\immediate\write\helptableout{\row, \col, \filled, \first, \thecount}
}
}
\immediate\closeout\helptableout
\pgfplotstableread[col sep=comma]{\helptablefilename}\helptable
\pgfplotstabletypeset[]{\helptable}
\section{Groupplot}
\pgfmathtruncatemacro\EndRowNo{\schemerows^2-1}
\setcounter{count}{-1}
\begin{tikzpicture}[font=\footnotesize]
\pgfplotsset{
nowarnings/.style={xmin=-1, xmax=5, ymin=-1, ymax=10},
Paint/.style={draw=#1,
every axis plot/.style={draw=#1, very thick}
},
}
\begin{groupplot}[group style={
group size={\schemerows} by {\schemerows},
},
height=30mm, width=30mm,
title style={align=left},
ytick=data,
]
\pgfplotsforeachungrouped \helptablerow in {0,...,\EndRowNo}{
\pgfplotstablegetelem{\helptablerow}{filled}\of\helptable
\pgfmathsetmacro\filled{\pgfplotsretval}
\pgfplotstablegetelem{\helptablerow}{first}\of\helptable
\pgfmathsetmacro\first{\pgfplotsretval}
\pgfplotstablegetelem{\helptablerow}{count}\of\helptable
\pgfmathsetmacro\datarow{\pgfplotsretval}
\pgfplotstablegetelem{\datarow}{k}\of\datatable
\pgfmathsetmacro\datavalue{\pgfplotsretval}
\ifnum\filled=0 \edef\tmp{
\noexpand\nextgroupplot[group/empty plot]
}\tmp
\else
\ifnum\first=1
\edef\tmp{ \noexpand\nextgroupplot[Paint=red]
\noexpand\addplot[]{\datavalue};
}\tmp
\else
\edef\tmp{ \noexpand\nextgroupplot[Paint=blue]
\noexpand\addplot[]{\datavalue};
}\tmp
\fi
\fi
}
\end{groupplot}
\end{tikzpicture}
\end{document}