Ask Your Question

# Combine two 3d plots

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 close merge delete

## 1 answer

Sort by » oldest newest most voted

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))

more

## Your Answer

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

Add Answer

## Stats

Asked: 2013-11-19 01:40:42 -0500

Seen: 366 times

Last updated: Nov 19 '13