Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How can I make a 3D scatter plot?

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.

How can I make a 3D scatter plot?

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.space. Using a viewer different from jmol or java3d at least shows something, but still not what I'm looking for.