Re: ListPlot ColorFunction

*To*: mathgroup at smc.vnet.net*Subject*: [mg99134] Re: ListPlot ColorFunction*From*: mike.honeychurch at gmail.com*Date*: Tue, 28 Apr 2009 04:44:27 -0400 (EDT)*References*: <gt3tma$npk$1@smc.vnet.net>

On Apr 27, 4:25 am, "Serych Jakub" <Ser... at panska.cz> wrote: > Dear Mathematica users, > first let me thank you for many nice zigzag solutions from my previous post. > > Today I have another question. I need to highlight some data points in > ListPlot by changing their color. How to do it? I tried the similar solution > which somebody have sent me time ago for the same problem which I had with > Plot, but it doesn't work with ListPlot. > > In the example below I'm trying to make the zero points Red and all other > Blue. > > ListPlot[{9, 4, 1, 0, 0, 0, 1, 4, 9}, Filling -> Axis, > PlotStyle -> PointSize[0.02], > ColorFunction -> (If[# == 0, RGBColor[1, 0, 0], RGBColor[0, 0, 1]]= &)] > > Thanks in advance for any help > > Jakub ColorFunction only works with Joined->True. Also your index should have been #2 instead of # in any case. I'm sure there must be an easier way to do this, but this works: list = Flatten@ MapIndexed[{If[#1 == 0, RGBColor[1, 0, 0], RGBColor[0, 0, 1]], Point[Reverse[{#1, #2[[1]]}]]} &, {9, 4, 1, 0, 0, 0, 1, 4, 9}]; Graphics[{AbsolutePointSize[6], list}, Frame -> True] Mike