MathGroup Archive 1992

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Using ListPlot3D with real x,y.z coordinates

  • To: mathgroup at
  • Subject: Re: Using ListPlot3D with real x,y.z coordinates
  • From: msdrl!nachbar at (Dr. Robert B. Nachbar)
  • Date: Mon, 14 Sep 92 22:48:07 EDT

Andy Provenza writes:
> I am interested in using mathematica to read in a file of x,y,z  
> coordinates and plot them in 3D.  ListPlot3D is used to plot an array  
> of heights, which tells me that you only can plot z values  
> corresponding to integer x and y values.  I've looked through the  
> text, but cannot figure out how to solve my problem.  I've had people  
> tell me that this type of plotting can be done using Mathematica, but  
> I have yet to see it.
It looks like he wants a 3D scatterplot, and there is not a built in
function for that. However, in the package Graphics'Graphics3D' (read
back quote for quote, I'm still not fully conversant with vi) there is a
function ScatterPlot3D which does the trick. The "Guide to Standard
Mathematica Packages" has the description of this and many other
functions. By way of example:


data=Table[15+10*Random[],{30},{3}] ;

{{19.8811, 22.9699, 22.8874}, {23.4377, 22.8386, 23.7227}, 
  {20.5372, 22.8358, 21.5624}, <<26>>, 
  {15.5109, 15.293, 17.6765}}


This produces a scatterplot with the default viewpoint and a box around
it. If you need to add colors to selected points, then you must used the
3D primitives Point and RGBColor. The basic scatterplot can be achieved
with the following call:

Show[Graphics3D[Point /@ data]] ;

By inserting RGBColor at the appropriate places, one can get the desired

primitives=Point /@ data ;
primitives=Insert[primitives,RGBColor[1,0,0],20] ;
primitives=Insert[primitives,RGBColor[0,1,0],10] ;

The first ten points are black, the second ten are green, and the third
ten are red.

Dr. Robert B. Nachbar | Merck Research Laboratories | 908/594-7795
nachbar at     | R50S-100                    | 908/594-4224 FAX
                      | PO Box 2000                 |
                      | Rahway, NJ 07065            |

  • Prev by Date: NoFillHistogram Package
  • Next by Date: Re: MMA sounds and snd
  • Previous by thread: Re: Using ListPlot3D with real x,y.z coordinates
  • Next by thread: NetPlot3D[]