# Shift data of the form Plot[g, {x, 0, 100},ImageSize->Large,....etc.]

If I have the following:

Show[data1, data2, data3,PlotRange -> {All, All}]

where data1, data2 and data3 are of the form Plot[g, {x, 0, 100},ImageSize->Large,....etc.]

How can I shift the data that I see in Show for data1, data2 and data3 without modifying the g of the data itself?

I was trying something like this, in order to shift the y axis of the plot stored in data1 by 0.1, the plot stored in data2 by 0.2 and the plot stored in data3 by 0.3:

Show[data1/. {x_, y_} -> {x, y+0.1}, data2/. {x_, y_} -> {x, y+0.2}, data3/. {x_, y_} -> {x, y+0.1},PlotRange -> {All, All}]


I know that the easiest way is simply to use /. {x_, y_} -> {x, y+0.1} in the individual data but I was wondering if it is possible to do like this?

Maybe Translate?:

p1 = p2 = p3 = Plot[Sin[x], {x, 0, 2 Pi}]

Show[
MapAt[Translate[#, {0, 0.1}] &, p1, 1],
MapAt[Translate[#, {0, 0.2}] &, p2, 1],
MapAt[Translate[#, {0, 0.3}] &, p3, 1],
PlotRange -> All
]


• Michael, one question. I am trying the same for plots with ListLinePlot rather than Plot and it doesn't seem to work for ListLinePlot. Is there something I can modify to make it work with ListLinePlot?
– John
Commented Jan 13, 2021 at 17:00
• @John The above works for me if I change the plot to p1 = p2 = p3 = ListLinePlot[Sin[N@Range[100]/17]]. It does not work for some other one? Commented Jan 13, 2021 at 17:48
• You are right, I was doing something incorrectly in my code. Also, is there any way to input rotation in your code? It only moves the curves up or down, correct?. Is there an easy modification to include rotation as well?. In other words, to have both translation and rotation.
– John
Commented Jan 13, 2021 at 22:28
• Michael E2, I plotted the question here as well: mathematica.stackexchange.com/questions/238184/…
– John
Commented Jan 13, 2021 at 22:41
• There's Rotate. Just compose them. Rotate[Translate[#, {0, 0.2}], 5 Degree] & or vice versa. There's also GeometricTransformation for general affine transformations of graphics. FindGeometricTransform can be used to find the affine transformation that aligns points as well as possible. Commented Jan 13, 2021 at 22:43
plot = Plot[2 x^2, {x, -2, 3}];
shifted = plot /. Line[l_List] :> {Red, Line[{#1, #2 + 3} & @@@ l]};
Show[{plot, shifted}]