Re: ListPlot: Choose segents to draw.
- To: mathgroup at smc.vnet.net
- Subject: [mg82368] Re: ListPlot: Choose segents to draw.
- From: Peter <petsie63 at googlemail.com>
- Date: Thu, 18 Oct 2007 05:01:48 -0400 (EDT)
- References: <ff4g7u$fmv$1@smc.vnet.net>
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