I want to plot 3D data from a file (data file) using pgfplots
. The data represents an ellipsoid. I want to draw the outer shell like in the following picture, just without the background and in grayscale:
I tried several approaches following the threads here and here but I had no luck. Eitherway I don't get the outer shell quadrilaterals of the ellipsoid, or gnuplot is running at 100% CPU load for several minutes without any result.
Is it possible to do this with pgfplots
and gnuplot or GNU Octave? How can it be done? Is the TeX memory sufficient?
My MWE:
\documentclass{scrreprt}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{pgfplots}
\usepackage{tikz}
\usetikzlibrary{calc}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\begin{figure}[htb]
\centering
\begin{tikzpicture}
\begin{axis}
\addplot3 [surf] gnuplot [raw gnuplot] {set dgrid3d 1152,1152 spline;splot 'criterion.txt';};
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}
Best Answer
Your data seems to be arranged in set of rectangular patches. So the key
patch type=rectangle
. Useopacity
options to avoid (for the most part) the superposition problem (with axis) produced by current limitations ofpgfplots
. (For absolute control over the 3D object and lighs use Asymptote instead, in any casepgfplots
will get you 99% there and it will be an improvement overgnuplot
).This generates this plot:
For reference
criterion.txt
data file looks like this:(total lines: 1152)