MathGroup Archive 2007

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

Search the Archive

Re: ListPointPlot3D

  • To: mathgroup at smc.vnet.net
  • Subject: [mg83021] Re: ListPointPlot3D
  • From: Norbert Marxer <marxer at mec.li>
  • Date: Wed, 7 Nov 2007 06:54:50 -0500 (EST)
  • References: <fgpa06$iu2$1@smc.vnet.net>

On 6 Nov., 09:52, SkyW <apa... at lpg.es> wrote:
> Hi,
>
> I would like to use ListPointPlot3D to plot several points in two different colors (ex. blue and red). I have a Table with following format:
>
> list0={{x1, y1, z1, h1}, {x2, y2, z2, h2}, ..., {xn, yn, zn, hn}}
>
> x,y,z refers to the 3D coordinates and h takes value 0 or 1. I would like to plot all points with h value equal to 1 as red and all points with h value equal to 0 as blue .... how can I do it?
>
> Thanks in advance. Best regards

Hello

The following code will do what you want:

liRed = Select[list0, #1[[4]] == 1 & ][[All, 1 ;; 3]];
liBlue = Select[list0, #1[[4]] == 0 & ][[All, 1 ;; 3]];
ListPointPlot3D[{liRed, liBlue}, PlotStyle -> {Red, Blue}]

You can test it with:

Clear[ri, rc, liRed, liBlue, list0]; SeedRandom[3];
ri := RandomInteger[{1, 10}];
rc := RandomChoice[{0, 1}];
list0 = Table[{ri, ri, ri, rc}, {100}];
liRed = Select[list0, #1[[4]] == 1 & ][[All, 1 ;; 3]];
liBlue = Select[list0, #1[[4]] == 0 & ][[All, 1 ;; 3]];
ListPointPlot3D[{liRed, liBlue}, PlotStyle -> {Red, Blue}]

Best Regards
Norbert Marxer







  • Prev by Date: Matrix multiplication speed up
  • Next by Date: Re: Bug of Integrate
  • Previous by thread: Re: ListPointPlot3D
  • Next by thread: Re: Re: ListPointPlot3D