Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2007

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

Search the Archive

Re: ListPointPlot3D

  • To: mathgroup at smc.vnet.net
  • Subject: [mg83011] Re: ListPointPlot3D
  • From: Thomas E Burton <tburton at brahea.com>
  • Date: Wed, 7 Nov 2007 06:34:00 -0500 (EST)

Given data in your format,

data=Table[{RandomReal[],RandomReal[],RandomReal[],RandomInteger[]}, 
{50}]

I vaguely recall a way to use the data directly, with the fourth  
element determining the color. But I cannot recall the details.

I tried to sort the data into two groups and then use PlotStyle to  
set the groups' colors, but I got bad results. The following  
inelegant approach seems to work. Define one color for each point:

colors = (Last /@ data) /. {0 -> Blue, 1 -> Red}

Then discard the last elements and isolate each point into its own  
list, so it will get its own color:

ListPointPlot3D[{Most[#]}&/@data,PlotStyle->({#,PointSize[0.025]}&/ 
@colors)]

It you can accept the default point size, then the above simplifies to

ListPointPlot3D[{Most[#]}&/@data,PlotStyle->colors]

Tom, version 6.0.1.0, Mac OS10.4.



  • Prev by Date: Re: ListPointPlot3D
  • Next by Date: Re: mathematica and Cplex
  • Previous by thread: Re: ListPointPlot3D
  • Next by thread: Re: ListPointPlot3D