# Surface plot of data does not produce expected result [closed]

I would like to make a surface plot of data.txt. I use the following code as a MWE.

\documentclass{article}

\usepackage{tikz,pgfplots}
\pgfplotsset{compat = 1.8}

\begin{document}

\begin{tikzpicture}
\begin{axis}
\addplot3[surf, mesh/ordering = y varies] table {data.txt};
\end{axis}
\end{tikzpicture}

\end{document}


This code produces the following result:

Using the same data in Matlab gives me the following surface plot, so this is the expected result.

I have searched quite a bit, but I just cannot find out what is wrong. I expect some sort of incorrect indexing.

## closed as off-topic by Jake, user31729, Svend Tveskæg, Guido, Benedikt BauerSep 10 '14 at 8:37

• This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

• Something went wrong with your data export, the data.txt file you posted doesn't correspond to the data shown in your second plot. For example, take a look at the point at (4,14): in your data.txt file, it has a value of 0.85, but in the plot it's almost zero. – Jake Sep 8 '14 at 16:25
• You are right, I was too focused on the LaTeX code and did not see the error in my data file. My apologies. I fixed it now. – Ritz Sep 9 '14 at 7:12
• Could you link to the new data.txt file? – Jake Sep 9 '14 at 17:26
• Since it was only some example data, I fixed the issue and went on to use my real data. I do not have the new data.txt file anymore. – Ritz Sep 10 '14 at 7:12
• Problem was caused by an incorrect data file. – Jake Sep 10 '14 at 7:26