Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*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 smc.vnet.net
  • Subject: [mg56231] Re: [mg56218] plot on condition
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Wed, 20 Apr 2005 05:30:02 -0400 (EDT)
  • Reply-to: hanlonr at cox.net
  • Sender: owner-wri-mathgroup at wolfram.com

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

Show[Graphics@
      {AbsolutePointSize@4,
        {If[#[[1]]==3,Blue,Green],
              Point@#[[2]]}&/@
          Thread@{cnd,pnts}},
    Frame->True, 
    PlotRange->{{-0.15,5.15},{-0.15,6.15}}];

or

Show[Graphics@
      {AbsolutePointSize@4,
        Thread@{cnd/.{3->Blue,_?NumericQ->Green},
            Point/@pnts}},
    Frame->True, 
    PlotRange->{{-0.15,5.15},{-0.15,6.15}}];


Bob Hanlon

> 
> Date: 2005/04/19 Tue AM 04:55:39 EDT
> Subject: [mg56231] [mg56218] plot on condition
> 
> 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
> 
> 


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