i´m trying to plot some x,y and z values from a .txt-file with gnuplot in Latex. The plotting itself works fine. The Problem is, that there should be a defined Outline surrounding my plot. Everything which is outside the Outline shouldnt be visible. So i tried to fill the area between the Outline and a Square but this doesnt work, i think that there are too much data in my Outline. Another method could be the one described here:Gnuplot 3D Heat mapping But i dont know how to put it in Latex.
So this is my code:
\RequirePackage{tikz}\RequirePackage{pgfplots}\documentclass{scrbook}\usepackage{xcolor}\usepackage{filecontents}\RequirePackage{tikz}\RequirePackage{pgfplots}\usepgfplotslibrary{fillbetween}\usepackage{tikzscale}\begin{document} \begin{tikzpicture}\begin{filecontents*}{Points.dat} #1 2 3 -0.346 0.28 207 -0.306 0.28 203 -0.266 0.28 210 -0.226 0.28 214 -0.226 0.20 244 -0.186 0.20 255 -0.266 0.12 248 -0.226 0.08 261 -0.186 0.08 246 0 0 320 0 0.3 260 -0.4 0.3 220 -0.4 0 240\end{filecontents*}\begin{filecontents*}{Outline.dat} #1 2 3 -0.38 0.01 500 -0.38 0.296 500 -0.32 0.298 500 -0.217 0.299 500 -0.017 0.149 500 -0.009 0.157 500 -0.006 0.127 500 -0.002 0.093 500 -0.001 0.069 500 -0.002 0.056 500 -0.38 0.01 500\end{filecontents*}\begin{filecontents*}{Rand.dat} #1 2 3 0.025 -0.025 500 0.025 0.325 500 -0.425 0.325 500 -0.425 -0.025 500 0.025 -0.025 500\end{filecontents*}\pgfdeclarelayer{pre main}\pgfsetlayers{pre main,main}\begin{axis}[colorbar, xmin=-0.45,xmax=0.05,ymin=-0.05,ymax=0.35,view={0}{90},]\begin{pgfonlayer}{pre main} \addplot3 [surf] gnuplot [raw gnuplot] { set dgrid3d 40,40 spline; splot 'Points.dat'; };\end{pgfonlayer}\begin{pgfonlayer}{main}\addplot3 [no markers, very thick, name path=A] table []{Outline.dat};\addplot3 [black,no markers, very thick, name path=B] table []{Rand.dat};%\addplot3 [white] fill between[of=A and B];\end{pgfonlayer} \end{axis}\end{tikzpicture}\end{document}
Thanks a lot!