Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Below is a bit of a hack, but I think it does what you want. I'll keep thinking of other options.

var('x,y,z')
f(x,y)=x^2+3*y^2
levels=[1,2,3,4]
epsilon=0.1
p=plot3d(f(x,y),(x,-2,2),(y,-2,2),color='khaki',opacity=0.7)
for h in levels:
    p+=implicit_plot3d(f(x,y)==h,(x,-2,2),(y,-2,2),(z,h,h+epsilon))

show(p)

Below is a bit of a hack, but I think it does what you want. I'll keep thinking of other options.

var('x,y,z')
f(x,y)=x^2+3*y^2
levels=[1,2,3,4]
epsilon=0.1
p=plot3d(f(x,y),(x,-2,2),(y,-2,2),color='khaki',opacity=0.7)
for h in levels:
    p+=implicit_plot3d(f(x,y)==h,(x,-2,2),(y,-2,2),(z,h,h+epsilon))

show(p)

image description

Below is a bit of a hack, but I think it does what you want. I'll keep thinking of other options.

var('x,y,z')
f(x,y)=x^2+3*y^2
levels=[1,2,3,4]
epsilon=0.1
p=plot3d(f(x,y),(x,-2,2),(y,-2,2),color='khaki',opacity=0.7)
for h in levels:
    p+=implicit_plot3d(f(x,y)==h,(x,-2,2),(y,-2,2),(z,h,h+epsilon))

show(p)

image description