[Tex/LaTex] How to prepare coordinates for 3D surface plot using pgfplots

3dcoordinatespgfplots

I'm trying to plot a Pareto front on 3 dimensions, using pgfplots.
However, although I expect a nice surface to appear (since it is a Pareto front), pgfplots does not produce the result I want (yet).

I have the feeling that I need to (somehow) sort or transform my collecion of coordinates to a matrix.
However, I could not find any information in the pgfplots manual regarding this.
I know there are plots available that do not require a matrix (the one in the MWE f.i.) but here the order really matters.

Any help on how to preprocess my data is appreciated.

The best I got so far as an MWE with the actual data I'm using.

\documentclass[tikz]{standalone}
\usepackage{pgfplots}       % Charts in LaTeX, or, even better, in TikZ!!!
\usepgfplotslibrary{patchplots}
\pgfplotsset{compat=1.10}
\begin{document}
\begin{figure}
  \begin{tikzpicture}
    \begin{axis}[title={3D plot of Pareto front},
      width=.75\textwidth,
      xlabel={Precision},
      ylabel={Replay Fitness},
      zlabel={Generalization},
      view/h=-60,
    ]
    \addplot3+
    [patch,patch type=biquadratic, shader=faceted interp,patch to triangles,patch refines=3,mark=none] 
      file {data.txt};
    \end{axis}
  \end{tikzpicture}
  \caption{3D plot of Pareto front.}
\end{figure} 
\end{document} 

Which results in:

Current result of plot

with data.txt as:

1.000000 0.419383 0.968689
1.000000 0.592352 0.968670
1.000000 0.746263 0.968656
1.000000 0.867638 0.968467
0.920836 0.968086 0.968154
0.639138 0.968335 0.968148
0.834616 0.972716 0.968135
1.000000 0.959536 0.968100
0.925890 0.968086 0.968100
0.843374 0.972253 0.968100
0.624724 0.994175 0.965305
0.592214 0.998805 0.965289
0.753481 0.993391 0.965285
0.740626 0.993727 0.965278
0.871820 0.993727 0.965277
0.785909 0.994025 0.965277
0.953650 0.993698 0.965273
0.805640 0.998855 0.965273
0.523510 0.999667 0.965029
0.564376 0.999738 0.965023
0.711429 0.999266 0.965001
0.879139 0.993727 0.964992
0.723471 0.999266 0.964992
0.659416 0.999528 0.964697
0.668084 0.999423 0.964666
0.677879 0.999423 0.964656
1.000000 0.979768 0.964530
0.450423 0.999843 0.954335
0.528080 0.999843 0.952593
0.843906 0.996905 0.950163
0.854689 0.993826 0.945594
0.738809 0.999266 0.945594
0.707177 0.999723 0.943947
0.544764 0.999778 0.943905
0.884787 0.993826 0.942041
0.757883 0.999266 0.942041
0.784359 0.999108 0.940599
0.604841 0.999778 0.939674
0.810387 0.998584 0.939038
0.482403 1.000000 0.938628
0.716901 0.999723 0.936281
0.559973 1.000000 0.935840
0.818384 0.997063 0.934713
0.725681 0.999557 0.926138
0.957708 0.980431 0.925825
0.819722 0.997010 0.921207
0.749411 0.999557 0.920465
0.596822 1.000000 0.917863
0.737162 1.000000 0.916918
0.824987 0.997010 0.899531

Update 1:

I have found an answer to a related question, and I'm trying to get GNUplot to triangulate my data such that I obtain a plane.
However, I think my question is still valid since I do not want a full plane from the min and max of the three axis, but only a surface connecting my concrete observations.

Best Answer

I managed to get the approach mentioned in update 1 working (kind of, although GNUplot is added to the Windows path, Latex does not find it...). I hope this update helps someone such that the hours I spend have some benefit for human society. The result, on a new dataset, is shown below

Correct Pareto front visualization

Code:

\begin{document}
\begin{figure}
  \begin{tikzpicture}
    \begin{axis}[%title={3D plot of Pareto front},
      width=.75\textwidth,
      ylabel={Precision},
      xlabel={Replay Fitness},
      zlabel={Generalization},
        view={75}{40},
    ]
       \addplot3 [surf, faceted color=blue] gnuplot [raw gnuplot]{
        cd "MY_MAIN_LATEX_DIR";
        set dgrid3d 30,30 qnorm 2;
        splot "data.txt"; %
        };
        \addplot3[only marks]
        file data.txt};
    \end{axis}
  \end{tikzpicture}
  \caption{3D plot of the Pareto front of candidates with perfect simplicity.}
  \label{fig:caseStudies_runExNoise_pareto_graph_Of_allG}
\end{figure}
\end{document}

On this newly obtained dataset:

1.0000  0.9277  0.8012
0.5924  0.9687  1.0000
0.9994  0.9647  0.6681
0.9995  0.7661  0.9190
0.9991  0.9038  0.9407
0.9937  0.9653  0.9291
0.9937  0.9653  0.9537
0.9934  0.9653  0.7535
0.9996  0.5437  0.9143
0.9987  0.9605  0.9275
0.9993  0.9509  0.7700
0.9994  0.8930  0.8912
0.9997  0.9041  0.8838
1.0000  0.9386  0.4824
0.9996  0.6511  0.9107
1.0000  0.8804  0.8510
0.9994  0.7355  0.9190
0.9987  0.9599  0.9906
0.9993  0.9650  0.7114
0.9996  0.5518  0.9120
0.9993  0.9172  0.8409
0.9997  0.9172  0.8048
0.9998  0.9084  0.8473
0.9991  0.9410  0.9288
0.9989  0.9653  0.8056
0.9996  0.6121  0.9120
0.9998  0.9543  0.4624
0.9993  0.9099  0.9357
0.9996  0.5441  0.9122
0.9993  0.8683  0.9381
0.9999  0.8459  0.8965
0.9993  0.9148  0.8778
0.9997  0.8523  0.8923
0.4194  0.9687  1.0000
0.9937  0.9650  0.9981
0.9937  0.9653  0.8718
0.9996  0.9122  0.8591
0.9996  0.7516  0.9079
0.9681  0.9682  0.9208
0.9993  0.8842  0.9074
0.9998  0.9439  0.5451
1.0000  0.7993  0.9031
0.9996  0.7238  0.9105
0.9993  0.8773  0.9374
1.0000  0.8610  0.8802
1.0000  0.9291  0.7801
0.9992  0.8981  0.9921
0.9990  0.9336  0.9340