Re: Re: ListPointPlot3D

• To: mathgroup at smc.vnet.net
• Subject: [mg83047] Re: [mg83021] Re: ListPointPlot3D
• From: DrMajorBob <drmajorbob at bigfoot.com>
• Date: Thu, 8 Nov 2007 06:15:59 -0500 (EST)
• References: <fgpa06\$iu2\$1@smc.vnet.net> <324636.1194441774037.JavaMail.root@m35>

```Even better, using Sow and Reap:

Clear[ri, rc, liRed, liBlue, list0];
SeedRandom[3];
ri := RandomInteger[{1, 10}];
rc := RandomInteger[];
list0 = Table[{ri, ri, ri, rc}, {100}];
{liRed, liBlue} = Last@Reap[Scan[Sow[Most@#, Last@#] &, list0]];
ListPointPlot3D[{liRed, liBlue}, PlotStyle -> {Red, Blue}]

Bobby

On Wed, 07 Nov 2007 05:54:50 -0600, Norbert Marxer <marxer at mec.li> wrote:

> 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
>
>
>
>
>
>
>

-- =

DrMajorBob at bigfoot.com

```

• Prev by Date: Re: Memory requirements in Mathematica 6
• Next by Date: Re: Matrix multiplication speed up
• Previous by thread: Re: Re: ListPointPlot3D
• Next by thread: 4D plotting ?