Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: plot on condition

  • To: mathgroup at
  • Subject: [mg56253] Re: [mg56218] plot on condition
  • From: "Wolf, Hartmut" <Hartmut.Wolf at>
  • Date: Wed, 20 Apr 2005 05:31:17 -0400 (EDT)
  • Sender: owner-wri-mathgroup at


>-----Original Message-----
>Sent: Tuesday, April 19, 2005 10:56 AM
>Subject: [mg56253] [mg56218] plot on condition
>my question about plotting a list of points but with some 
>condition depends on 
>the status of points in other list;
>the condition is: plot a point in list "pnts" in Blue if the 
>element in list "cnd" is 3 else plot in Green

Define a function for the graphics directives

gd[3] = Sequence[PointSize[.025], Hue[2/3, 1, .7]];
gd[_] = Sequence[PointSize[.015], Hue[1/3, 1, .7]];

...and MapThread

      MapThread[{gd[#2], Point[#1]} &, {pnts, cnd}]}]]

Of course, in case of only a single graphics directive you need no
Sequence, in case of none, {} is good as well as Sequence[], e.g.:

gd[3] = Sequence[PointSize[.025], Hue[2/3, 1, .7]];
gd[_] = {};

Show[Graphics[{PointSize[.015], Hue[1/3, 1, .7], 
      MapThread[{gd[#2], Point[#1]} &, {pnts, cnd}]}]]

Hartmut Wolf

  • Prev by Date: Re: match 1, replace 2
  • Next by Date: Re: holding boxes verbatim
  • Previous by thread: Re: plot on condition
  • Next by thread: Re: plot on condition