Einschränken des Bereichs des 3D-Diagramms

Einschränken des Bereichs des 3D-Diagramms

Ich habe dieses 3D-Diagramm:

Bildbeschreibung hier eingeben

Ich möchte die Funktion darstellennurüber der Region über der dunkleren Hälfte des Bodens (dem Teil, der näher bei uns ist).

Hier ist ein MWE:

\PassOptionsToPackage{usenames,dvipsnames,table,x11names}{xcolor}
\documentclass[a4paper, 12pt]{article}
\usepackage{pgfplots}
\usepgfplotslibrary{colormaps,fillbetween}

\begin{document}

\begin{tikzpicture}

\begin{axis}[
zmax=15,
zmin=0,
view = {45}{45},
grid=minor,
colormap={mycol}{color=(Tan), color=(Tan)},
xlabel = $s$,
ylabel = $h$,
zlabel = {$f(s,h)$},
ticks = none,
]

\addplot3[
surf,
samples=30,
domain=0:1.5,
%y domain = 0:x, %does not work
opacity=0.5,
]
{12*exp(-(4*x+3*y))};

%highlighting dark part of bottom
\filldraw[Tan, fill = Tan, opacity = 0, fill opacity = 0.5] (0,0,0) -- (1.5,1.5,0) -- (1.5,0,0) -- (0,0,0);

%line across bottom
\draw[RawSienna, thick, opacity = 0.75] (0,0,0) -- (1.5,1.5,0);

%line going across graph
\addplot3 [domain=0:1.5, RawSienna, thick, samples=30, samples y=0, opacity = 0.75] (x,x,{12*exp(-(7*x))});

\end{axis}
\end{tikzpicture}

\end{document}

Ich habe versucht, zu verwenden y domain = 0:x, aber das kompiliert nicht einmal (es dauert zu lange und stürzt dann ab). Irgendwelche Vorschläge?

Antwort1

\pgfplotsset{compat=1.16}So etwas wie das hier? (Beachten Sie, dass diese leicht modifiziert werden muss, wenn Sie stattdessen eine sehr alte Version möchten , d. h. den Koordinaten \clipmuss ein , vorangestellt werden axis cs:. \clip plot[variable=\x,domain=0:1.5] (axis cs:\x,\x,{f(\x,\x)}) -- (axis cs:1.5,0,{f(1.5,1.5)}) -- (axis cs:0,0,{f(1.5,1.5)}) -- (axis cs:0,0,{f(0,0)});)

\PassOptionsToPackage{usenames,dvipsnames,table,x11names}{xcolor}
\documentclass[a4paper, 12pt]{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\usepgfplotslibrary{colormaps,fillbetween}

\begin{document}

\begin{tikzpicture}[declare function={f(\x,\y)=12*exp(-(4*\x+3*\y));}]

\begin{axis}[
zmax=15,
zmin=0,
view = {45}{45},
grid=minor,
colormap={mycol}{color=(Tan), color=(Tan)},
xlabel = $s$,
ylabel = $h$,
zlabel = {$f(s,h)$},
ticks = none,
]

\begin{scope}
 \clip plot[variable=\x,domain=0:1.5] (\x,\x,{f(\x,\x)})
 -- (1.5,0,{f(1.5,1.5)}) -- (0,0,{f(1.5,1.5)}) -- (0,0,{f(0,0)});
 \addplot3[
 surf,
 samples=30,
 domain=0:1.5,
 %y domain = 0:x, %does not work
 opacity=0.5,
 ] {f(x,y)};
\end{scope}

%highlighting dark part of bottom
\filldraw[Tan, fill = Tan, opacity = 0, fill opacity = 0.5] (0,0,0) -- (1.5,1.5,0) -- (1.5,0,0) -- (0,0,0);


%line across bottom
\draw[RawSienna, thick, opacity = 0.75] (0,0,0) -- (1.5,1.5,0);

line going across graph
\addplot3 [domain=0:1.5, RawSienna, thick, samples=30, samples y=0, opacity = 0.75] 
(x,x,{f(x,x)});

\end{axis}
\end{tikzpicture}

\end{document}

Bildbeschreibung hier eingeben

verwandte Informationen