# Plotting 3d from different Excel Files

i have several Excel Files (.csv) which are built up like the following scheme:

Instruction Averange ddv 500 6717.10 300 600 7572.30 300 [...]

So basicalle the column "Instrcution" is the same in every Excel File. "Dependency Degree (aka ddv)" runs from 0 to 500 in 50 steps. I now want to plot a 3d plot looking like this:

It is a picture of a very Similar Problem but i cant adjust their solution to my problem. The Code i got so far is this:

\begin{tikzpicture}
\begin{axis}[
xlabel={Instructioncount},
ylabel={Degree of Dependence},
zlabel={Lines of Code},
]
\addplot3 [surf] table[x = Instruction, y = ddv, z = Average, col sep = semicolon] {Compiler_Benchmarks/CodeLengthAfterCompiling_350.csv};
\addplot3 [surf] table[x = Instruction, y = ddv, z = Average, col sep = semicolon] {Compiler_Benchmarks/CodeLengthAfterCompiling_300.csv};
\end{axis}
\end{tikzpicture}


That results in:

Basically "all i want" is to get latex to combine both separate lines in a area and not only two independent lines. I added both example Excel-files: Excel Files Basically i just want tex to draw a countinous area between both lines so that it looks like a area.

• Welcome to TeX.SE! Most likely this is due to your data. Could you append a small sample to your question?
– user121799
Sep 3 '18 at 11:22
• I uploaded both files: ftp.tu-ilmenau.de/… Sep 3 '18 at 11:34
• To me your data seems to be one-dimensional. That is, for every x value, there is one y and z value. You are using two separate plots. In the linked answer it is discussed how to create one data file instead. I guess you should do that here, too.
– user121799
Sep 3 '18 at 11:52
• @marmot i dont know how to properly merge them automatically with latex, because in the linked example it seems that he has 3 files: 1 for x,y and z. But i have mutliple files (10) that all share praticalley 1 axes and differ in the other 2 Sep 3 '18 at 12:22

You need to combine the two tables to a new table, which needs to be sorted. I also changed the view and personally I'd also rotate the axes labels, but this is up to you.

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{pgfplots,pgfplotstable}
\pgfplotsset{compat=1.16}
\begin{document}
\pgfplotstableset{col sep=semicolon} % from https://tex.stackexchange.com/a/188492/121799
\pgfplotstablevertcat{\output}{Compiler_Benchmarks/CodeLengthAfterCompiling_350.csv} % loads CodeLengthAfterCompiling_350.csv' -> \output'
\pgfplotstablegetrowsof{\output}
\pgfmathtruncatemacro{\numrows}{\pgfplotsretval} % finds number of columns
\pgfplotstablevertcat{\output}{Compiler_Benchmarks/CodeLengthAfterCompiling_300.csv}% appends the entries of CodeLengthAfterCompiling_300.csv to output
\pgfplotstablesort{\sorted}{\output} % sorts the entries
\begin{tikzpicture}
\begin{axis}[view={-35}{35},
xlabel={Instructioncount},
ylabel={Degree of Dependence},
zlabel={Lines of Code},
xlabel style={sloped like x axis},
ylabel style={sloped},
]
\addplot3 [surf,mesh/rows=\numrows,shader=faceted, faceted color = none] table[x = Instruction, y = ddv, z = Average, col sep =
semicolon] \sorted;
\end{axis}
\end{tikzpicture}
\end{document}


• Another Question: is it possible to delete the \output table after the use ? I got weird problems with "lstlisting" because it adds the first line of output in the text bevor the listing. Sep 6 '18 at 16:36
• @Incanus How would I know? I do not know what your document looks like. Just try to put \def\output{} after the plot, I guess it will work.
– user121799
Sep 6 '18 at 16:38