Update:
ClearAll[showF]
showF[tr_: {10, 10}, rt_: {-Pi/4, {0, 0}},
opts : OptionsPattern[{Graphics, Graphics3D}]][g_] :=
Module[{head = Head[g], pr = PlotRange[g],
transF=Composition[TranslationTransform[tr], RotationTransform[rt[[1]], rt[[2]]]]},
Module[{prim = If[head === Graphics3D, Cuboid, Rectangle] @@Transpose[pr],
points = Cases[Normal@g, (Line | Point | Tube)[x_, ___] :> x, Infinity][[1]],
axes = Thread[{#, {##2}}, List, {2}] & @@
Nearest[#, #[[1]], If[head === Graphics3D, 4, 3]] &@Tuples[pr], gr2},
gr2 = {g[[1]], EdgeForm[Directive[GrayLevel[.4], AbsoluteThickness[.02]]],
FaceForm[], prim, Arrow /@ axes};
head[{gr2, GeometricTransformation[gr2, transF], Red, Dashed,
Line /@ Transpose[{points, transF /@ points}]}, opts]]]
Examples:
gr = Graphics[{Line[{{0, 1}, {1, 5}, {2, 4}, {4, 7}, {5, 2}, {6, 3}, {7, 1}}]},
PlotRange -> {{0, 7}, {0, 7}}];
llp = ListLinePlot[{{0, 1}, {1, 5}, {2, 4}, {4, 7}, {5, 2}, {6, 3}, {7, 1}},
BaseStyle -> Thick, PlotRangePadding -> 0];
lp = ListPlot[RandomReal[3, 10], PlotStyle -> Directive[PointSize[.03], Orange]];
Row[showF[{10, 10}, {-Pi/4, {0, 0}}, Axes -> True, ImageSize -> 300] /@ {gr, llp, lp}]
grb = Graphics3D[Cases[gr,
Line[x_, ___] :> Line[Insert[#, #2, 2] & @@@ Thread[{x, 0}]], Infinity],
ImageSize -> 400, PlotRange -> {{0, 7}, {0, 2}, {0, 7}}];
showF[{5, 5, 5}, {Pi/4, {0, 1, 0}}, Axes -> True, ImageSize -> 400]@grb
tubes = Graphics3D[{Opacity[.7], CapForm["Butt"],
Tube[{{1, 1, 0}, {3, 1, 0}, {5, 5, 0}, {5, 2, 5}, {1, 3, 5}}, .25]}];
showF[{10, 5, 5}, {-Pi/4, {0, 1, 0}}]@tubes
Original post:
gr = Graphics[{Line[{{0, 1}, {1, 5}, {2, 4}, {4, 7}, {5, 2}, {6, 3}, {7, 1}}]}];
Graphics[{gr2 = Graphics[{Arrow[{{0, 1}, #}] & /@ ({#, Reverse@#2} & @@
PlotRange[gr]), gr[[1]]}][[1]],
GeometricTransformation[GeometricTransformation[gr2, RotationTransform[-45 Degree]],
TranslationTransform[{10, 10}]]}, Axes -> True,
AxesOrigin -> {0, 0}]
Alternatively, define a function that does the required transformations given a graphics object as input:
ClearAll[gtF, showF]
gtF[tr_: {10, 10}, rt_: - Pi/4] := With[{transF =
Composition[TranslationTransform[tr], RotationTransform[rt]]},
GeometricTransformation[#, transF]] &;
showF[tr_: {10, 10}, rt_: - Pi/4, opts : OptionsPattern[Graphics]] :=
With[{gr2 = Graphics[{Arrow /@ ({{#, #2}, {#, #3}} & @@
Tuples[PlotRange@#]), #[[1]]}][[1]]},
Graphics[{gr2, gtF[tr, rt]@gr2}, opts]] &;
llp = ListLinePlot[{{0, 1}, {1, 5}, {2, 4}, {4, 7}, {5, 2}, {6, 3}, {7, 1}},
BaseStyle -> Thick];
Row[showF[{10, 10}, -Pi/4, Axes -> True, ImageSize -> 300] /@
{gr, llp, ListPlot[RandomReal[1, 20]]}]
Note: You can also use the function gtF
with MapAt
as follows:
Show[llp, MapAt[gtF[], FullGraphics@llp, {1}], PlotRange -> All]