1

I have a data table like this:

Time,Data1,Data2,Data3,Data4,Data5
0,0,0,0,0,0
0.01001001001001,-4.30013814154693e-05,-3.65528966153454e-05,-5.39214806453237e-05,-5.27331238958749e-05,-4.96325738789991e-05
0.02002002002002,9.6646652917441e-06,9.87705901291089e-06,1.64726912970149e-05,2.06890807177468e-05,1.11612272326899e-05
0.03003003003003,1.05330531657191e-05,9.24425302969856e-06,1.55903678076454e-05,1.79416214446286e-05,2.61621953728649e-05
0.04004004004004,8.10490160624311e-06,7.50045715311939e-06,1.08376703306448e-05,1.17728044427963e-05,2.78930073538393e-05
...

So far I've been able to make a 3D line plot of each data column against time.

\begin{figure}
\begin{tikzpicture}
\begin{axis}[no markers]
\pgfplotsinvokeforeach{1,2,...,5}{
\addplot3 table[x index=0, y expr=#1, z index=#1, col sep=comma] {data.dat};
}
\end{axis}
\end{tikzpicture}
\end{figure}

enter image description here

What I'd like to do is make a surface plot that 'connects' these line plots together. I'm thinking the expressions will be something like this, assuming i is the row number, and j is a number between 1 and 5:

x = (i,0), y = j, z = (i,j)

Is there a way to implement this in PGFPlots without having to reshape the data?

Stefan Pinnow
  • 29,535
  • 1
    At first sight I would say it is not possible. You need to provide x,y,z triplets for each point of your surface. What software do you use to generate the data ? If you can't reshape the data externally, you could use pgfplotstable to do this. – BambOo Jul 13 '20 at 09:46
  • @BambOo That's what I've done at the moment using create on use with copy column from table and set and then vertcat to stick it all together in a macro. It's clunky, slow and inelegant so I was wondering if there's a better solution. – Crazymoomin Jul 13 '20 at 09:53
  • 1
    At present there is no such feature in PGFPlots. But it was asked for that some time ago already (https://github.com/pgf-tikz/pgfplots/issues/310). There you can also find links to answers of @Faekynn (https://tex.stackexchange.com/a/502680/95441 and https://tex.stackexchange.com/a/503823/95441) who has written Lua scripts to resort the data. I didn't check, if one of them suits your needs. If so, please let us know. – Stefan Pinnow Jul 21 '20 at 12:48

0 Answers0