Is there a way to have these contour lines hidden by the surface in the foreground?
Is there a way to make these contour lines hidden by the surface in the foreground?
I would like to only see the contour lines in the background

documentclass{standalone}
usepackage{pgfplots}
usepackage{amsmath}
begin{document}
begin{tikzpicture}[scale=1.8]
begin{axis}[view={35}{40},
hide axis,
xlabel=$x$,ylabel=$y$,
mesh/interior colormap name=hot,
colormap/hot]
addplot3[domain=-2.5:2.5,surf,shader =faceted interp]
{-exp(-0.5*x^2-0.5*y^2)};
addplot3 [domain =-2.5:2.5, contour gnuplot = {number=2, labels={false},
draw color = red}, samples = 21, ]
{-exp(-0.5*x^2-0.5*y^2)};
end{axis}
end{tikzpicture}
end{document}
pgfplots 3d
add a comment |
Is there a way to make these contour lines hidden by the surface in the foreground?
I would like to only see the contour lines in the background

documentclass{standalone}
usepackage{pgfplots}
usepackage{amsmath}
begin{document}
begin{tikzpicture}[scale=1.8]
begin{axis}[view={35}{40},
hide axis,
xlabel=$x$,ylabel=$y$,
mesh/interior colormap name=hot,
colormap/hot]
addplot3[domain=-2.5:2.5,surf,shader =faceted interp]
{-exp(-0.5*x^2-0.5*y^2)};
addplot3 [domain =-2.5:2.5, contour gnuplot = {number=2, labels={false},
draw color = red}, samples = 21, ]
{-exp(-0.5*x^2-0.5*y^2)};
end{axis}
end{tikzpicture}
end{document}
pgfplots 3d
2
not really. pgfplots don't know this kind of z-ordering.
– percusse
Nov 12 '16 at 8:19
For this kind of plot you should look for a specialized 3D plot software.
– projetmbc
Nov 12 '16 at 10:27
Maybe Asymptote could to this easily.
– projetmbc
Nov 12 '16 at 10:28
In fact mathematica does that ..but the problem you can edit the graph or add labels or other objects to it
– Ruzayqat
Nov 12 '16 at 22:10
add a comment |
Is there a way to make these contour lines hidden by the surface in the foreground?
I would like to only see the contour lines in the background

documentclass{standalone}
usepackage{pgfplots}
usepackage{amsmath}
begin{document}
begin{tikzpicture}[scale=1.8]
begin{axis}[view={35}{40},
hide axis,
xlabel=$x$,ylabel=$y$,
mesh/interior colormap name=hot,
colormap/hot]
addplot3[domain=-2.5:2.5,surf,shader =faceted interp]
{-exp(-0.5*x^2-0.5*y^2)};
addplot3 [domain =-2.5:2.5, contour gnuplot = {number=2, labels={false},
draw color = red}, samples = 21, ]
{-exp(-0.5*x^2-0.5*y^2)};
end{axis}
end{tikzpicture}
end{document}
pgfplots 3d
Is there a way to make these contour lines hidden by the surface in the foreground?
I would like to only see the contour lines in the background

documentclass{standalone}
usepackage{pgfplots}
usepackage{amsmath}
begin{document}
begin{tikzpicture}[scale=1.8]
begin{axis}[view={35}{40},
hide axis,
xlabel=$x$,ylabel=$y$,
mesh/interior colormap name=hot,
colormap/hot]
addplot3[domain=-2.5:2.5,surf,shader =faceted interp]
{-exp(-0.5*x^2-0.5*y^2)};
addplot3 [domain =-2.5:2.5, contour gnuplot = {number=2, labels={false},
draw color = red}, samples = 21, ]
{-exp(-0.5*x^2-0.5*y^2)};
end{axis}
end{tikzpicture}
end{document}
pgfplots 3d
pgfplots 3d
edited Nov 12 '16 at 8:18
percusse
136k13254493
136k13254493
asked Nov 12 '16 at 4:03
Ruzayqat
21015
21015
2
not really. pgfplots don't know this kind of z-ordering.
– percusse
Nov 12 '16 at 8:19
For this kind of plot you should look for a specialized 3D plot software.
– projetmbc
Nov 12 '16 at 10:27
Maybe Asymptote could to this easily.
– projetmbc
Nov 12 '16 at 10:28
In fact mathematica does that ..but the problem you can edit the graph or add labels or other objects to it
– Ruzayqat
Nov 12 '16 at 22:10
add a comment |
2
not really. pgfplots don't know this kind of z-ordering.
– percusse
Nov 12 '16 at 8:19
For this kind of plot you should look for a specialized 3D plot software.
– projetmbc
Nov 12 '16 at 10:27
Maybe Asymptote could to this easily.
– projetmbc
Nov 12 '16 at 10:28
In fact mathematica does that ..but the problem you can edit the graph or add labels or other objects to it
– Ruzayqat
Nov 12 '16 at 22:10
2
2
not really. pgfplots don't know this kind of z-ordering.
– percusse
Nov 12 '16 at 8:19
not really. pgfplots don't know this kind of z-ordering.
– percusse
Nov 12 '16 at 8:19
For this kind of plot you should look for a specialized 3D plot software.
– projetmbc
Nov 12 '16 at 10:27
For this kind of plot you should look for a specialized 3D plot software.
– projetmbc
Nov 12 '16 at 10:27
Maybe Asymptote could to this easily.
– projetmbc
Nov 12 '16 at 10:28
Maybe Asymptote could to this easily.
– projetmbc
Nov 12 '16 at 10:28
In fact mathematica does that ..but the problem you can edit the graph or add labels or other objects to it
– Ruzayqat
Nov 12 '16 at 22:10
In fact mathematica does that ..but the problem you can edit the graph or add labels or other objects to it
– Ruzayqat
Nov 12 '16 at 22:10
add a comment |
1 Answer
1
active
oldest
votes
If you don't mind drawing the surface twice and cliping the second plot, you can do:
documentclass{standalone}
usepackage{pgfplots}
pgfplotsset{compat=1.16}
usepackage{amsmath}
begin{document}
begin{tikzpicture}[scale=1.8,declare function={f(x,y)=-exp(-0.5*x^2-0.5*y^2);}]
begin{axis}[view={35}{40},
hide axis,
xlabel=$x$,ylabel=$y$,
mesh/interior colormap name=hot,
colormap/hot]
addplot3[domain=-2.5:2.5,domain y=-2.5:2.5,surf,shader =faceted interp]
{f(x,y)};
addplot3 [domain =-2.5:2.5, contour gnuplot = {number=2, labels={false},
draw color = red}, samples = 21] {f(x,y)};
%draw[blue,thick]
clip
plot[variable=x,domain=-2.5:2.5] (x,-2.5,{f(x,-2.5)})
-- plot[variable=x,domain=-2.5:2.5] (2.5,x,{f(2.5,x)})
to[out=-90,in=0] (0,0,{f(0,0)-0.1})
to[out=180,in=-90] (-2.5,-2.5,{f(-2.5,-2.5)});
addplot3[domain=-2.5:2.5,domain y=-2.5:2.5,surf,shader =faceted interp]
{f(x,y)};
end{axis}
end{tikzpicture}
end{document}

add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f338724%2fis-there-a-way-to-have-these-contour-lines-hidden-by-the-surface-in-the-foregrou%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
If you don't mind drawing the surface twice and cliping the second plot, you can do:
documentclass{standalone}
usepackage{pgfplots}
pgfplotsset{compat=1.16}
usepackage{amsmath}
begin{document}
begin{tikzpicture}[scale=1.8,declare function={f(x,y)=-exp(-0.5*x^2-0.5*y^2);}]
begin{axis}[view={35}{40},
hide axis,
xlabel=$x$,ylabel=$y$,
mesh/interior colormap name=hot,
colormap/hot]
addplot3[domain=-2.5:2.5,domain y=-2.5:2.5,surf,shader =faceted interp]
{f(x,y)};
addplot3 [domain =-2.5:2.5, contour gnuplot = {number=2, labels={false},
draw color = red}, samples = 21] {f(x,y)};
%draw[blue,thick]
clip
plot[variable=x,domain=-2.5:2.5] (x,-2.5,{f(x,-2.5)})
-- plot[variable=x,domain=-2.5:2.5] (2.5,x,{f(2.5,x)})
to[out=-90,in=0] (0,0,{f(0,0)-0.1})
to[out=180,in=-90] (-2.5,-2.5,{f(-2.5,-2.5)});
addplot3[domain=-2.5:2.5,domain y=-2.5:2.5,surf,shader =faceted interp]
{f(x,y)};
end{axis}
end{tikzpicture}
end{document}

add a comment |
If you don't mind drawing the surface twice and cliping the second plot, you can do:
documentclass{standalone}
usepackage{pgfplots}
pgfplotsset{compat=1.16}
usepackage{amsmath}
begin{document}
begin{tikzpicture}[scale=1.8,declare function={f(x,y)=-exp(-0.5*x^2-0.5*y^2);}]
begin{axis}[view={35}{40},
hide axis,
xlabel=$x$,ylabel=$y$,
mesh/interior colormap name=hot,
colormap/hot]
addplot3[domain=-2.5:2.5,domain y=-2.5:2.5,surf,shader =faceted interp]
{f(x,y)};
addplot3 [domain =-2.5:2.5, contour gnuplot = {number=2, labels={false},
draw color = red}, samples = 21] {f(x,y)};
%draw[blue,thick]
clip
plot[variable=x,domain=-2.5:2.5] (x,-2.5,{f(x,-2.5)})
-- plot[variable=x,domain=-2.5:2.5] (2.5,x,{f(2.5,x)})
to[out=-90,in=0] (0,0,{f(0,0)-0.1})
to[out=180,in=-90] (-2.5,-2.5,{f(-2.5,-2.5)});
addplot3[domain=-2.5:2.5,domain y=-2.5:2.5,surf,shader =faceted interp]
{f(x,y)};
end{axis}
end{tikzpicture}
end{document}

add a comment |
If you don't mind drawing the surface twice and cliping the second plot, you can do:
documentclass{standalone}
usepackage{pgfplots}
pgfplotsset{compat=1.16}
usepackage{amsmath}
begin{document}
begin{tikzpicture}[scale=1.8,declare function={f(x,y)=-exp(-0.5*x^2-0.5*y^2);}]
begin{axis}[view={35}{40},
hide axis,
xlabel=$x$,ylabel=$y$,
mesh/interior colormap name=hot,
colormap/hot]
addplot3[domain=-2.5:2.5,domain y=-2.5:2.5,surf,shader =faceted interp]
{f(x,y)};
addplot3 [domain =-2.5:2.5, contour gnuplot = {number=2, labels={false},
draw color = red}, samples = 21] {f(x,y)};
%draw[blue,thick]
clip
plot[variable=x,domain=-2.5:2.5] (x,-2.5,{f(x,-2.5)})
-- plot[variable=x,domain=-2.5:2.5] (2.5,x,{f(2.5,x)})
to[out=-90,in=0] (0,0,{f(0,0)-0.1})
to[out=180,in=-90] (-2.5,-2.5,{f(-2.5,-2.5)});
addplot3[domain=-2.5:2.5,domain y=-2.5:2.5,surf,shader =faceted interp]
{f(x,y)};
end{axis}
end{tikzpicture}
end{document}

If you don't mind drawing the surface twice and cliping the second plot, you can do:
documentclass{standalone}
usepackage{pgfplots}
pgfplotsset{compat=1.16}
usepackage{amsmath}
begin{document}
begin{tikzpicture}[scale=1.8,declare function={f(x,y)=-exp(-0.5*x^2-0.5*y^2);}]
begin{axis}[view={35}{40},
hide axis,
xlabel=$x$,ylabel=$y$,
mesh/interior colormap name=hot,
colormap/hot]
addplot3[domain=-2.5:2.5,domain y=-2.5:2.5,surf,shader =faceted interp]
{f(x,y)};
addplot3 [domain =-2.5:2.5, contour gnuplot = {number=2, labels={false},
draw color = red}, samples = 21] {f(x,y)};
%draw[blue,thick]
clip
plot[variable=x,domain=-2.5:2.5] (x,-2.5,{f(x,-2.5)})
-- plot[variable=x,domain=-2.5:2.5] (2.5,x,{f(2.5,x)})
to[out=-90,in=0] (0,0,{f(0,0)-0.1})
to[out=180,in=-90] (-2.5,-2.5,{f(-2.5,-2.5)});
addplot3[domain=-2.5:2.5,domain y=-2.5:2.5,surf,shader =faceted interp]
{f(x,y)};
end{axis}
end{tikzpicture}
end{document}

edited 46 mins ago
answered 1 hour ago
marmot
86.9k499185
86.9k499185
add a comment |
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f338724%2fis-there-a-way-to-have-these-contour-lines-hidden-by-the-surface-in-the-foregrou%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
not really. pgfplots don't know this kind of z-ordering.
– percusse
Nov 12 '16 at 8:19
For this kind of plot you should look for a specialized 3D plot software.
– projetmbc
Nov 12 '16 at 10:27
Maybe Asymptote could to this easily.
– projetmbc
Nov 12 '16 at 10:28
In fact mathematica does that ..but the problem you can edit the graph or add labels or other objects to it
– Ruzayqat
Nov 12 '16 at 22:10