Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Re: conditional plotstyles in ListPlot

  • To: mathgroup at
  • Subject: [mg73368] Re: conditional plotstyles in ListPlot
  • From: Bill Rowe <readnewsciv at>
  • Date: Wed, 14 Feb 2007 05:19:54 -0500 (EST)

On 2/13/07 at 6:56 AM, nycstern at (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

Here is one way...

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

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