MathGroup Archive 2007

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

Search the Archive

Re: conditional plotstyles in ListPlot


On 2/13/07 at 6:56 AM, nycstern at gmail.com (Stern) wrote:

>I am plotting a time series and would like to use different colors
>for points above the x-axis from the colors below the x-axis. I can
>think of some relatively inelegant ways of doing this, splitting my
>dataset in two, plotting them separately, and them showing the
>graphs together, but I feel as though there may be a better
>solution.

Here is one way...

In[1]:=
data = Table[Random[] - 0.5, {20}];

In[5]:=
Show[Graphics[{PointSize[.015],Transpose[{Range[20], data,
Sign[data]}] /.
      {{a_, b_, 1} -> {Black, Point[{a, b}]},
       {a_, b_, -1} -> {Red, Point[{a, b}]}}}],
    Axes -> Automatic];
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: RandomArray from user defined distribution?
  • Next by Date: Re: conditional plotstyles in ListPlot
  • Previous by thread: conditional plotstyles in ListPlot
  • Next by thread: Re: conditional plotstyles in ListPlot