Plotting a 3d graph and a 2d contour map on the same plot
Is it possible to plot a 3d graph and a 2d contour map on the same plot?
Thank you!
Is it possible to plot a 3d graph and a 2d contour map on the same plot?
Thank you!
You may want to take a look at this post. Another option :
var('x y z')
g(x,y,z) = 2+2*(1-x)^2*exp(-(x^2) - (y+1)^2) +2*abs(x/5 - x^3 - y^5)*exp(-x^2-y^2)+ 1*exp(-(x+1)^2 - y^2)
f = z==g
S = plot3d(g(x,y), (x,-2,2),(y,-2,2), mesh=0, color = "orange", opacity = 0.5, frame = False, projection = "orthographic")
levels=srange(2,7,0.5)
Contours = Graphics()
for zlevel in levels:
S+=implicit_plot3d(g(x,y,z)-zlevel, (x,-2,2),(y,-2,2),(z,zlevel - 0.02,zlevel + 0.02),thickness=1, color = "brown")
for zlevel in levels:
Contours+=implicit_plot3d(f(x,y,zlevel), (x,-2,2),(y,-2,2),(z,- 0.03,+0.03),thickness=3, color = "blue")
S +=Contours
S += arrow3d((0,0,0),(2,0,0), color = "black")
S += text3d("x", (2.2,0,0), color = "black")
S += arrow3d((0,0,0),(0,3,0), color = "black")
S += text3d("y", (0,3.2,0), color = "black")
S += arrow3d((0,0,0),(0,0,7), color = "black")
S += text3d("z", (0,0,7.2), color = "black")
S += plot3d(0, (x,-2,2),(y,-2,2), color = "blue", opacity=0.25)
show(S)
Please start posting anonymously - your entry will be published after you log in or create a new account.
Asked: 2023-10-04 17:26:02 +0100
Seen: 168 times
Last updated: Oct 05 '23
Plot Series of 3D Direction Vectors (Not All from Origen)
filling in an area under a function or curve in 3 dimensions
How can i generate a 3D plot with more details?
Saving 3d pictures as anaglyphs
Color plots on surface of sphere
can I create isosurface contours from list data?
A concrete example of what you aim to do would be a great help...