MathGroup Archive 2006

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

Search the Archive

Re: ScatterPlot3D with One More Dimension?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg65156] Re: [mg65136] ScatterPlot3D with One More Dimension?
  • From: Darren Glosemeyer <darreng at wolfram.com>
  • Date: Wed, 15 Mar 2006 23:59:30 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

At 06:29 AM 3/15/2006 -0500, Matt Thompson wrote:
>Folks, I'm wondering if it's possible to add a dimension to a 
>ScatterPlot3D in the form of color?  I have a Perl script that generates a 
>list of {x,y,z} for a SP3D from a molecular dynamics trajectory, and it 
>does work, but the plot is just mono.
>
>Rather, I'd like to change the color of certain points depending on the 
>state the trajectory is on at that time.  That is, a sort of 
>RGBColor[1,0,0] for some points, then back to [0,0,0] for others, &c.
>
>Is this possible, or should I start exploring IDL, et al?


One possibility is to construct the graphic directly as a Graphics3D object.

data = Table[{Random[], Random[], Random[]}, {50}];

The following will make all elements of data with a total greater than 1 
red, and all other points will be black.

Show[Graphics3D[Map[If[Total[#] > 1,
           {PointSize[.02], Red, Point[#]},
           {PointSize[.02], Black, Point[#]}] &, data]],
         Axes -> True]

The following replaces the red coloring with RGBColor applied to the data 
element.

Show[Graphics3D[Map[If[Total[#] > 1,
           {PointSize[.02], Apply[RGBColor, #], Point[#]},
           {PointSize[.02], Black, Point[#]}] &, data]],
         Axes -> True]

The following is an example with 4 dimensional data where the first 3 
dimensions are plotted and the fourth dimension determines the color.

data4d = Table[{Random[], Random[], Random[], Random[]}, {50}];

Show[Graphics3D[Map[If[#[[-1]] > .3,
         {PointSize[.02], Red, Point[Most[#]]},
         {PointSize[.02], Black, Point[Most[#]]}] &, data4d]],
         Axes -> True]


Darren Glosemeyer
Wolfram Research


  • Prev by Date: Re: Errors at discontinuities
  • Next by Date: Re: Question: DiracDelta simplifies/integrates incorrectly?
  • Previous by thread: Re: ScatterPlot3D with One More Dimension?
  • Next by thread: Errors at discontinuities