# Offset plot in Mathematica

I have a figure obtained from ParametricPlot, which is relatively costly to obtain.

For example:

I would like to offset the picture in terms of a parameter, for example x1, so that the figure is drawn at (x1, 0) instead of at (0, 0). In other words, I would like to apply a transformation consisting of a slide over the X axis.

I have tried with Translate and GeometricTransformation but it does not seem to work on plot outputs.

Is this possible?

• Please, post your code to get help. Meanwhile, just add a constant $x_1$ to your $f_x$ component in ParametricPlot. Mar 26, 2018 at 13:35
• related, not sure if duplicate: mathematica.stackexchange.com/q/17250/9490 Mar 26, 2018 at 13:44
• Recalculating the figure using ParametricPlot is not an option, it is too much time consuming. Mar 26, 2018 at 13:55

You have the output of your plot, and you want to modify the coordinates without replotting. You can do this easily when you realize the output from any Plot function will be a Graphics object that you can manipulate like any other expression.

For this case, we can use ReplaceAll to replace any coordinate pair of real numbers with a transformed version of it.

plot = RegionPlot[
x^2 + y^3 < 2 && x + y < 1, {x, -2, 2}, {y, -2, 2}];
tfunc = TranslationTransform[{5, 5}];
plot2 = Show[
plot /. pt : {x_Real, y_Real} :> tfunc@pt,
PlotRange -> {{3, 7}, {3, 7}}
];
{plot, plot2}


ReplaceAll is a blunt instrument, it replaces any occurrence of its pattern, so this could lead to unwanted side effects by replacing pairs of real numbers that don't represent a coordinate pair. But in most cases this works fine.

• Since ParametricPlot[], RegionPlot[], and ilk produce a GraphicsComplex[] object, the safe way is to apply your transformations to that, e.g. Show[plot /. GraphicsComplex[pts_, rest__] :> GraphicsComplex[TranslationTransform[{5, 5}][pts], rest], PlotRange -> {{3, 7}, {3, 7}}] Mar 26, 2018 at 13:48
• Thank you for this excellent solution! Mar 26, 2018 at 13:54