Re: Plotting just specific points
- To: mathgroup at smc.vnet.net
- Subject: [mg54141] Re: [mg54043] Plotting just specific points
- From: "Wolf, Hartmut" <Hartmut.Wolf at t-systems.com>
- Date: Fri, 11 Feb 2005 03:34:33 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
>-----Original Message----- >From: zak [mailto:chocolatez at gmail.com] To: mathgroup at smc.vnet.net >Sent: Wednesday, February 09, 2005 3:27 PM >To: mathgroup at smc.vnet.net >Subject: [mg54141] [mg54043] Plotting just specific points > >if i have the list: >a={5,1,2,2,6,7,2,2,8,2} >and in the ListPlot[a] i want to show only the points wich >represent only the "2" while preserving the positions of the >"2" in the list, so i could focus my attention to a specific >wanted values, how could i do that or even better if it is >possible to plot the whole values of ListPlot[a] while making >the points "2" in red color as an example. >thanks >zak > > As for a simple example check: In[10]:= b = MapIndexed[If[#1 == 2, Append[#2, #1], Unevaluated[Sequence[]]] &, a] Out[10]= {{3, 2}, {4, 2}, {7, 2}, {8, 2}, {10, 2}} In[11]:= ListPlot[a, PlotJoined -> True, Epilog -> {Hue[0], PointSize[.02], Point /@ b}] You may refine this on the selection criteria or formatting the points reflecting further properties. (Perhaps this appears to be a simpler selection: In[12]:= b = Cases[Transpose[{Range[Length[a]], a}], {_, 2}] Out[12]= {{3, 2}, {4, 2}, {7, 2}, {8, 2}, {10, 2}} of course other variants exist) -- Hartmut Wolf