Re: Re: ListPlot: Choose segents to draw.
- To: mathgroup at smc.vnet.net
- Subject: [mg82410] Re: [mg82368] Re: ListPlot: Choose segents to draw.
- From: DrMajorBob <drmajorbob at bigfoot.com>
- Date: Fri, 19 Oct 2007 05:07:36 -0400 (EDT)
- References: <ff4g7u$fmv$1@smc.vnet.net> <4301103.1192718799769.JavaMail.root@m35>
- Reply-to: drmajorbob at bigfoot.com
I like this better, showing points descending vs lines ascending:
valuedata = (pointdata = ({#1, Sin[#1]} &) /@ (Pi*0.02*
Range[0, 100]))[[All, 2]];
Clear[ascending]
ascending[tbl : {{__?NumericQ} ..}] :=
Replace[Partition[tbl, 2, 1],
pair : {{_, a_}, {_, b_}} :> {AbsolutePointSize[1 + Boole[b <= a]],
Point@pair, GrayLevel@Boole[b <= a], Line@pair}, {1}]
ascending[tbl : {__?NumericQ}] :=
ascending[Thread[{Range@Length@tbl, tbl}]]
Show[Graphics[ascending@pointdata], Frame -> True, AspectRatio -> 1/2]
Show[Graphics[ascending@valuedata], Frame -> True, AspectRatio -> 1/2]
I don't think any of these methods will be useful with hundreds of curves
on the same chart, however.
Bobby
On Thu, 18 Oct 2007 04:01:48 -0500, Peter <petsie63 at googlemail.com> wrote:
> On Oct 17, 10:13 am, Nacho <ncc1701... at gmail.com> wrote:
>> Hello all.
>>
>> Using Mathematica V6, I have several hundred lists to plot.
>>
>> They draw OK just with
>>
>> ListPlot[mytable, Joined->True,PlotRange->All]
>>
>> But several hundred plots are a mess. I'm only interested in the
>> segments of each list that are increasing, that is, for every x(i),
>> x(i)>x(i+1).
>>
>> Is there any set of options to ListPlot to make the descending
>> segments invisible? Some kind of MeshShading to choose betweet
>> Automatic and None depending of two consecutive values.
>>
>> If I have to create a new mytable, please bear in mind that the total
>> length of the lists must remain equal.
>>
>> Thanks a lot for your help.
>
> Hi,
>
> from the context I guess you mean x(i)<x(i+1) ?
>
> AFAIK, there's no such Option to ListPlot, but it's easy to simulate
> such behaviour. You do not tell us if your data has got x- and y-
> values or if it is a list of single values. So I'll show you both:
>
> In[1]:=
> valuedata = (pointdata = ({#1, Sin[#1]} & ) /@ (Pi*0.02*Range[0, 100]))
> [[All,2]];
> In[8]:=
> ListPlot[pointdata, PlotJoined -> True]; (* just to verify if
> everything is OK so far *)
> In[4]:=
> cleanup[tbl:{{__?NumericQ}..}] := ({GrayLevel[Boole[Last[Subtract @@
> #1] >= 0]],
> Line[Join[#1]]} & ) /@ Partition[tbl, 2, 1];
> cleanup[tbl:{__?NumericQ}] := cleanup[Thread[{Range[Length[tbl]],
> tbl}]]
> (Show[Graphics[cleanup[#1]], Axes -> True] & ) /@ {pointdata,
> valuedata};
>
> This will draw decreasing linesegments in white, the rest in black.
>
> hth,
> Peter
>
>
>
--
DrMajorBob at bigfoot.com