Ask Your Question

Revision history [back]

How to combine 3d and 2d plots?

Hi, I am trying to include 2d plots of a 3d functions in specific points, fx. if i have a plottet function z=y*z and then i want to plot a function over when y=1 or 2 or 3 and so on. or when x=1 or 2 or 3 and so on.

I am dealing with this assignment:

sage: x,y,z = var('x,y,z')
sage: f = x^2+sqrt(y)

Then i can prepare that one for a 3d plot

sage: P = f.plot3d((x,-5,5),(y,-5,5),color="red",opacity=0.7)

Then i read something somewhere that you can put the cuts in the 3dplot by

sage: plot3d(z=0, **kwds)

and they gave the EXAMPLE:

sage: sum([plot(z*sin(x), 0, 10).plot3d(z) for z in range(6)]) #long

So for my case i try

sage: S = sum([plot(x^2+sqrt(y), -5,5 for y in range(6)])
sage: K = P+S

Because i don't know how to include the z axis in the example. So i get some lines but they are lying down on the x/y axis i tried changing the variable y with z but it doesnt change anything.

Please help me!

Kind regards Martin Mårtensson