MathGroup Archive 2005

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

Search the Archive

Re: listplot two lists of different lengths

  • To: mathgroup at smc.vnet.net
  • Subject: [mg59998] Re: [mg59989] listplot two lists of different lengths
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Sun, 28 Aug 2005 03:07:34 -0400 (EDT)
  • Reply-to: hanlonr at cox.net
  • Sender: owner-wri-mathgroup at wolfram.com

Needs["Statistics`"];
Needs["Graphics`"];

l1=Transpose[{Range[1,200,2],
        Sort[RandomArray[NormalDistribution[1,0.5],100]]}];
l2=Transpose[{Range[1,200],
        Sort[RandomArray[NormalDistribution[1,1],200]]}];

DisplayTogether[
    ListPlot[l1,
      PlotStyle->{AbsoluteThickness[2],Red},
      PlotJoined->True],
    ListPlot[l2,
      PlotStyle->{AbsoluteThickness[2],Blue},
      PlotJoined->True],
    Frame->True,Axes->False,PlotRange->All];

Note that with DisplayTogether, suppression of the individual plots is handled 
automatically so that DisplayFunction need not be specified.  Also, Frame, 
Axes, and PlotRange options should be moved to DisplayTother rather than 
repeated in the individual plots.


Bob Hanlon

> 
> From: "sean_incali" <sean_incali at yahoo.com>
To: mathgroup at smc.vnet.net
> Date: 2005/08/27 Sat AM 04:11:28 EDT
> Subject: [mg59998] [mg59989] listplot two lists of different lengths
> 
> let's say you have lists of different lengths
> 
> 
> << Statistics`ContinuousDistributions`
> << Graphics`Graphics`
> << Graphics`Colors`
> 
> l1 = RandomArray[NormalDistribution[1, 0.5], 100];
> l2 = RandomArray[NormalDistribution[1, 1], 200];
> 
> DisplayTogether[
> ListPlot[Sort@l1, PlotStyle -> {PointSize[0.015], Red}, DisplayFunction
> -> Identity, Frame -> True, Axes -> False, PlotRange -> All ],
> ListPlot[Sort@l2, PlotStyle -> {PointSize[0.015], Blue},
> DisplayFunction -> Identity, Frame -> True, Axes -> False],
> 
> DisplayFunction -> $DisplayFunction]
> 
> shows red is off to the left hand side because the list plotted in red
> is shorter inn length that one in blue.
> 
> How do I stretch the scale for the list in red, so the plots are scaled
> to same axis? (taking half as many points for longer list doesn't work
> for me)
> 
> the best way will be to stretch the red line...
> 
> thanks for any inputs
> 
> sean
> 
> 


  • Prev by Date: Re: listplot two lists of different lengths
  • Next by Date: Re: Re: ListDensityPlot and transparency
  • Previous by thread: Re: listplot two lists of different lengths
  • Next by thread: help working with functions