Ask Your Question
0

Combine two 3d plots

asked 2013-11-19 08:40:42 +0200

qed gravatar image

It's possible to combine two 2d plots in one:

sum([plot(x^n,(x,0,1),color=rainbow(5)[n], figsize=3) for n in range(5)])

How can this be done for 3d plots? For example, I tried this:

implicit_plot3d(x^2+y^2+z^2==4, (x, -3, 3), (y, -3,3), (z, -3,3)) + implicit_plot3d(x^2+y^2+1.75^2=4, (x, -3, 3), (y, -3, 3), (z, -3, 3))

But it generates this error:

File "<ipython-input-8-6cd08d1c769f>", line 1
SyntaxError: keyword can't be an expression
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2013-11-19 09:40:14 +0200

kcrisman gravatar image

You have a very small typo. == is for an equation, but = is for keywords. Try this.

var('x,y,z')
implicit_plot3d(x^2+y^2+z^2==4, (x, -3, 3), (y, -3,3), (z, -3,3)) + implicit_plot3d(x^2+y^2+1.75^2==4, (x, -3, 3), (y, -3, 3), (z, -3, 3))
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-11-19 08:40:42 +0200

Seen: 589 times

Last updated: Nov 19 '13