Re: DataRange
- To: mathgroup at smc.vnet.net
- Subject: [mg83548] Re: DataRange
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Thu, 22 Nov 2007 04:59:50 -0500 (EST)
- Organization: Uni Leipzig
- References: <fi0q05$6ib$1@smc.vnet.net>
- Reply-to: kuska at informatik.uni-leipzig.de
Hi,
insert the correct x-values ? with
With[{dx1 = 0.5},
fullData1 = MapIndexed[{#2[[1]]*dx1, #1} &, data1]
]
With[{dx2 = 0.5},
fullData2 = MapIndexed[{#2[[1]]*dx2, #1} &, data2]
]
ListPlot[{fullData1, fullData2}]
clear ly you have to insert for dx1 and dx2 the values you
have ..
Regards
Jens
thomas wrote:
> Hello Mathgroup,
>
> I use ListLinePlot to plot some data that has been downsampled. In
> order to get the original time-range of the data represented correctly
> on the x-axis, I use DataRange->{1,Length-of-original-data}, which
> works just beautifully.
>
> Now imagine I want to plot 2 sets of data with different original
> length, both have been downsampled. As far as I know, I cannot use the
> DataRange option anymore, because it will equally apply to both
> curves, therefore either stretching or compressing one curve relative
> to the other.
>
> Example:
> data1 = Range[5];(*imagine original length is 50*)
> data2 = .5 Range[10];(*imagine original length is 100*)
> ListLinePlot[{data1, data2}, Frame -> True, AspectRatio -> Full,
> PlotLabel -> "Correct relative scale of data"]
> ListLinePlot[{data1, data2}, DataRange -> {1, 50}, Frame -> True,
> AspectRatio -> Full, PlotLabel -> "data2 is compressed"]
> ListLinePlot[{data1, data2}, DataRange -> {1, 100}, Frame -> True,
> AspectRatio -> Full, PlotLabel -> "data1 is streched"]
>
>
> Is there an easy way to do this, short of creating specific {x,y}-
> pairs for each data point in each of the curves?
>
> As a suggestion to WRI I would propose that one should be able to give
> multiple inputs to DataRange, to handle these issues, similar to way
> the option PlotStyle->...handles the directives given to it.
>
> thomas
>