First time here? Check out the FAQ!

Ask Your Question
0

How can I make a 3D scatter plot?

asked 9 years ago

A.P. gravatar image

updated 9 years ago

I would like to get an idea of the behaviour of a function that takes an integer and a real number as arguments and returns an integer, so I set out to make a 3D scatter plot over a discretisation of its domain. The problem is that I cannot find any 3D scatter plot function in the documentation.

To make a 2D scatter plot I could use either the aptly named scatter_plot function or the list_plot function, but according to the documentation the homologous list_plot3d function tries to plot a surface interpolated from the input points, instead. For example, in the notebook I get

sage: list_plot3d([[1,2,3], [2,3,4], [3,4,5]], point_list=True)
/usr/lib/python2.7/site-packages/sage/repl/rich_output/display_manager.p\
y:570: RichReprWarning: Exception in _rich_repr_ while displaying
object: Jmol failed to create file
'/home/ap/.sage/temp/ap-arch-64/3172/dir_fZXWvL/preview.png', see
'/home/ap/.sage/temp/ap-arch-64/3172/tmp_jVjWT8.txt' for details
  RichReprWarning,
Graphics3d Object

instead of a plot of three points in Euclidean space. Using a viewer different from jmol or java3d at least shows something, but still not what I'm looking for.

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
2

answered 9 years ago

kcrisman gravatar image

I would try by just making a list L of your points and then plotting points(L) or point3d(L). I believe that list_plot3d does indeed (intentionally) do what you report, because that is what the analogous Mathematica function does (or did at the time it was written, anyway).

Preview: (hide)
link

Comments

point3d does a great job, thank you! Despite being an occasional Sage user for a couple of years now, I'm still having some serious difficulties browsing and, most importantly, searching through the documentation...

A.P. gravatar imageA.P. ( 9 years ago )
1

Yes, you are correct. There are a number of tutorials that in some ways are better than just searching the documentation, and I suspect that Greg Bard's (free!) Sage intro book would help you out in some ways. But the final "missing manual" has yet to be written.

kcrisman gravatar imagekcrisman ( 9 years ago )

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 9 years ago

Seen: 1,901 times

Last updated: Nov 30 '15