# 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. – José Antonio Díaz Navas Mar 26 '18 at 13:35
• related, not sure if duplicate: mathematica.stackexchange.com/q/17250/9490 – Jason B. Mar 26 '18 at 13:44
• Recalculating the figure using ParametricPlot is not an option, it is too much time consuming. – Guillermo Oliver Mar 26 '18 at 13:55

## 1 Answer

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}}] – J. M. is away Mar 26 '18 at 13:48
• Thank you for this excellent solution! – Guillermo Oliver Mar 26 '18 at 13:54