Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: ListPlot ColorFunction

  • To: mathgroup at smc.vnet.net
  • Subject: [mg99132] Re: ListPlot ColorFunction
  • From: "M.Roellig" <markus.roellig at googlemail.com>
  • Date: Tue, 28 Apr 2009 04:44:05 -0400 (EDT)
  • References: <gt3tma$npk$1@smc.vnet.net>

Dear Jakub,

I haven't found a way to assign different styles to selected points
from a list. But
you can assign a seperate PlotStyle to seperate lists. I split your
data lists into one list
per data point:

dat = {9, 4, 1, 0, 0, 0, 1, 4, 9};
lst = Partition[Table[{i, dat[[i]]}, {i, 1, Length@dat}], 1];
clrs = Table[
   If[dat[[i]] == 0, {Blue, PointSize[0.02]}, {Red,
     PointSize[0.04]}], {i, 1, Length@dat}];

ListPlot[lst, PlotStyle -> clrs]


Cheers,

Markus

On 27 Apr., 11:25, "Serych Jakub" <Ser... at panska.cz> wrote:
> Dear Mathematica users,
> first let me thank you for many nice zigzag solutions from my previous po=
st.
>
> 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 solut=
ion
> which somebody have sent me time ago for the same problem which I had wit=
h
> 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



  • Prev by Date: Re: ListPlot ColorFunction
  • Next by Date: Hadamard von Koch
  • Previous by thread: Re: ListPlot ColorFunction
  • Next by thread: Re: ListPlot ColorFunction