       Re: plot on condition

• To: mathgroup at smc.vnet.net
• Subject: [mg56254] Re: [mg56218] plot on condition
• From: DrBob <drbob at bigfoot.com>
• Date: Wed, 20 Apr 2005 05:31:24 -0400 (EDT)
• References: <200504190855.EAA02625@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Needs["Graphics`Colors`"] (* not needed as of 5.1 *)

pnts = {{1, 2}, {5, 4}, {3, 2}, {2, 6}, {5, 3}};
cnd = {7, 3, 5, 8, 3};

coloredPoints = {If[#2 == 3,
Blue, Green], Point@#1} & @@@ Transpose@{pnts, cnd};
Show[Graphics@{AbsolutePointSize, coloredPoints}, Frame -> True];

or

coloredPoints = Transpose@{
cnd /. {3 -> Blue, x_Integer -> Green}, Point /@ pnts};
Show[Graphics@{AbsolutePointSize, coloredPoints}, Frame -> True]

Bobby

> hello
> my question about plotting a list of points but with some condition depends on
> the status of points in other list;
> pnts={{1,2},{5,4},{3,2},{2,6},{5,3}};
> cnd={7,3,5,8,3};
> the condition is: plot a point in list "pnts" in Blue if the corresponding
> element in list "cnd" is 3 else plot in Green
> regards
>
>
>
>

--
DrBob at bigfoot.com

```

• Prev by Date: Re: assigning functions
• Next by Date: Re: plot on condition
• Previous by thread: Re: plot on condition
• Next by thread: Re: plot on condition