# Pgfplots parallel coordinate plot and display multivariate data

I'm looking for a method to display multivariate data with a parallel coordinate plot and want to make the figure in pgfplots because my whole document uses pgfplots for the figures. The way this plot looks is rather simple. Example is given here.

Does anyone have any clue on how to make the connecting lines with pgfplots?

Making each axis seems rather simple, but I can't figure out how to connect the point of each axis. My input data is a simple matrix with c columns (= result set) and l lines (number of simulation runs).

• Welcome to TeX.SX! Would you be so kind as to provide a minimal working example (MWE) of how far you have gotten? This will greatly help us help you. – sk8forether Jun 8 '17 at 14:16
• Instead of overlaying bunch of pgfplots, I would scale the data and plot the whole thing in one go (axis lines=none), then overlay the different axes using regular tikz. – John Kormylo Jun 8 '17 at 14:25
• @JohnKormylo do you have a rough overview for me what you mean? can't figure it out exactly. – ayayhuibui Jun 8 '17 at 14:39
• Can you create an MWE by entering some fake data using pgfplotstable? – John Kormylo Jun 8 '17 at 15:10

This is inefficient enough that it might not be interesting, but in case it is. iris.dat is a text file with the iris dataset, so it has header row + 150 data rows and 4 columns.

\documentclass[border=10pt]{standalone}
\usepackage{pgfplotstable}
% get number of data points
\pgfplotstablegetrowsof{\iris}
\pgfmathsetmacro\NumRows{\pgfplotsretval-1}

\usepgfplotslibrary{groupplots}
\pgfplotsset{compat=1.14}
\begin{document}

\begin{tikzpicture}
\begin{groupplot}[
group style={
group name=iris,
group size=4 by 1,
horizontal sep=2cm
},
axis y line=left,
hide x axis,
width=2cm,
height=6cm,
xmin=0,
xmax=0.5,
enlarge y limits,
every axis plot/.append style={opacity=0}
]

\nextgroupplot

\pgfplotsinvokeforeach{0,...,\NumRows} % loop over all rows in table
{
% get value in sw column
\pgfplotstablegetelem{#1}{sw}\of{\iris}%
% add a coordinate at x=0 and that y-value
\temp
}

\nextgroupplot

\pgfplotsinvokeforeach{0,...,\NumRows}
{
\pgfplotstablegetelem{#1}{sl}\of{\iris}%
\temp
}

\nextgroupplot

\pgfplotsinvokeforeach{0,...,\NumRows}
{
\pgfplotstablegetelem{#1}{pw}\of{\iris}%
\temp
}

\nextgroupplot

\pgfplotsinvokeforeach{0,...,\NumRows}
{
\pgfplotstablegetelem{#1}{pl}\of{\iris}%
\temp
}

\end{groupplot}

\foreach \i/\txt in {1/SW,2/SL,3/PW,4/PL}
\node [below] at (iris c\i r1.south west) {\txt};

% draw the lines
% this dataset has three groups of fifty rows each, hence the start/stop values
\foreach[
evaluate=\j as \START using int(\j*50),
evaluate=\j as \STOP using int((\j+1)*50-1),
] \j/\clr in {0/blue,1/red,2/green}
{
\foreach \i in {\START,...,\STOP}
\draw [color=\clr,opacity=0.5] (sl\i) -- (sw\i) -- (pl\i) -- (pw\i);
}

\end{tikzpicture}
\end{document}