Ask Your Question
0

How can I make a 3D scatter plot?

asked 2015-11-29 17:29:16 +0100

A.P. gravatar image

updated 2015-11-29 17:33:23 +0100

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.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2015-11-30 14:51:34 +0100

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

edit flag offensive delete link more

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. ( 2015-11-30 16:57:00 +0100 )edit
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 ( 2015-11-30 19:48:40 +0100 )edit

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: 2015-11-29 17:29:16 +0100

Seen: 1,823 times

Last updated: Nov 30 '15