Re: conditional plotstyles in ListPlot
- To: mathgroup at smc.vnet.net
- Subject: [mg73368] Re: conditional plotstyles in ListPlot
- From: Bill Rowe <readnewsciv at sbcglobal.net>
- Date: Wed, 14 Feb 2007 05:19:54 -0500 (EST)
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