Re: Plotting just specific points
- To: mathgroup at smc.vnet.net
- Subject: [mg54119] Re: Plotting just specific points
- From: Bill Rowe <readnewsciv at earthlink.net>
- Date: Fri, 11 Feb 2005 03:33:30 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
On 2/9/05 at 9:27 AM, chocolatez at gmail.com (zak) wrote: >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 a = {5, 1, 2, 2, 6, 7, 2, 2, 8, 2}; ListPlot[Select[Transpose@{Range@Length@a, a}, Last@# == 2&]]; >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. b = Transpose@{Range@Length@a, a}; Show[ Block[{$DisplayFunction = Identity}, {ListPlot[Select[b, Last@# != 2&]], ListPlot[Select[b, Last@#1 == 2&], PlotStyle -> {PointSize[0.015], Hue[0]}]}]]; And there are many other variations on these. For example, I could have constructed b in the code above as: b = MapIndexed[Flatten@{#2,#1}&,a] or b = MapThread[List, {Range@Length@a, a}] or I could use LabeledListPlot or MultipleListPlot in the Graphics add ons. For example, << "Graphics`"; LabeledListPlot[ MapThread[ {#1, #2, If[#2 == 2, "2", ""]} & , {Range[Length[a]], a}], AxesOrigin -> {0, 0}, PlotRange -> {{0, 11},{0, 8.2}}]; -- To reply via email subtract one hundred and four