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).

  • 2
    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. Jun 8, 2017 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. Jun 8, 2017 at 14:25
  • @JohnKormylo do you have a rough overview for me what you mean? can't figure it out exactly.
    – ayayhuibui
    Jun 8, 2017 at 14:39
  • Can you create an MWE by entering some fake data using pgfplotstable? Jun 8, 2017 at 15:10

1 Answer 1


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.

enter image description here

% read in data file
% get number of data points


  group style={
    group name=iris,
    group size=4 by 1,
    horizontal sep=2cm
  axis y line=left,
  hide x axis,
  enlarge y limits,
  every axis plot/.append style={opacity=0}


\pgfplotsinvokeforeach{0,...,\NumRows} % loop over all rows in table
  % get value in sw column
   % add a coordinate at x=0 and that y-value
  \edef\temp{\noexpand\addplot coordinates {(0,\pgfplotsretval)} coordinate (sl#1);}


  \edef\temp{\noexpand\addplot coordinates {(0,\pgfplotsretval)} coordinate (sw#1);}


  \edef\temp{\noexpand\addplot coordinates {(0,\pgfplotsretval)} coordinate (pl#1);}


  \edef\temp{\noexpand\addplot coordinates {(0,\pgfplotsretval)} coordinate (pw#1);}


% add labels below
\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
 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);


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .