# Rescaling the data points

Lets say I have the following data points,

 data1 = {26.96930425, 26.94343471, 26.89912143, 26.84923793,
26.83813424, 26.78747592, 26.77180729, 26.7344019, 26.69865987,
26.67581011, 26.64927891}

data2 = {27.31813031, 27.2891453, 27.25729205, 27.28633558,
27.28700594, 27.30034307, 27.27765688, 27.25401703, 27.26704573,
27.27382588, 27.25844849, 27.2781408, 27.25090313, 27.24495574,
27.22815005, 27.18166762}

a=ListLinePlot[{data1, data2}]


is there any way to reduce the length of data2 to length of data1 i.e. Length[data2]=Length[data1] while retaining the original shape of the plot of data2?

so at the end a=ListLinePlot[{data1, data2}] but within the same range.

You can do this by adding x-coordinates with the same range for both plots:

dat1 = Transpose[{Range[Length[data1]], data1}];
dat2 = Transpose[{Range[1,
Length[data1], (Length[data1] - 1)/(Length[data2] - 1)],
data2}];
ListLinePlot[{dat1, dat2}]


Another way is

ListLinePlot[{data1, data2[[1 ;; Dimensions[data1][[1]]]]}]


There are TrimRight and TrimLeft in the GeneralUtilities package

Needs["GeneralUtilities"]

ListLinePlot[TrimRight[{data1, data2}], GridLines -> Automatic]


Using DataRange:

data1 = {26.96930425, 26.94343471, 26.89912143, 26.84923793,
26.83813424, 26.78747592, 26.77180729, 26.7344019, 26.69865987,
26.67581011, 26.64927891};

data2 = {27.31813031, 27.2891453, 27.25729205, 27.28633558,
27.28700594, 27.30034307, 27.27765688, 27.25401703, 27.26704573,
27.27382588, 27.25844849, 27.2781408, 27.25090313, 27.24495574,
27.22815005, 27.18166762};


p0 = ListLinePlot[{data1, data1 + 0.04, data2, data2 + 0.04}
, PlotRange -> {26, 28}
, PlotStyle -> {Purple, Lighter@Purple, Brown, Lighter@Brown}
];
pout = ListLinePlot[data2, DataRange -> {1, Length@data1},
PlotStyle -> {Thick, Red}, PlotRange -> {26, 28}];

Show[p0, pout]
`