First time here? Check out the FAQ!

Ask Your Question
0

Combine two 3d plots

asked 11 years ago

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
Preview: (hide)

1 Answer

Sort by » oldest newest most voted
2

answered 11 years ago

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))
Preview: (hide)
link

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: 11 years ago

Seen: 666 times

Last updated: Nov 19 '13