# Shifting of Data plots [duplicate]

I have the following data plots for the voltage curve vs time. I want to shift the plots on the x axis such that the peaks and troughs coincide. Any ideas as to how to go about doing this will be appreciated

• Please post the data you have here, or on Pastebin if it is too large. Mar 21, 2017 at 14:21
• Maybe not quite a duplicate question, but @Thomas's answer mathematica.stackexchange.com/a/41577/2079 is the exact answer to this. Mar 21, 2017 at 15:18

I don't have your data so I'll generate my own:

datax = Table[i/100, {i, 1, 100}];
data1 = Table[Exp[-(i - 50 + 10)^2/20^2] + .1 RandomReal[], {i, 1, 100}];
data2 = Table[Exp[-(i - 50 + 0)^2/20^2] + .1 RandomReal[], {i, 1, 100}];
data3 = Table[Exp[-(i - 50 - 20)^2/20^2] + .1 RandomReal[], {i, 1, 100}];

Show[
ListPlot[Transpose[{datax, data1}], PlotStyle -> Blue],
ListPlot[Transpose[{datax, data2}], PlotStyle -> Red],
ListPlot[Transpose[{datax, data3}], PlotStyle -> Green]
]


In order to shift the data so that the maxima coincide, we can use

Show[
ListPlot[Transpose[{datax - datax[[Position[data1, Max[data1]][[1, 1]]]], data1}], PlotStyle -> Blue],
ListPlot[Transpose[{datax - datax[[Position[data2, Max[data2]][[1, 1]]]], data2}], PlotStyle -> Red],
ListPlot[Transpose[{datax - datax[[Position[data3, Max[data3]][[1, 1]]]], data3}], PlotStyle -> Green]
]


• It did work. Only I had to replace ListPlot with ListLinePlot. I would be grateful if you could explain what you did here Mar 21, 2017 at 17:40