How to scale and shift the coordinates of a Graphics object?
You can use Scale
on First @ g2
(which contains the graphics directives and primitives):
Show[g1, Graphics @ Scale[First @ g2, 2, {1, 1}], AspectRatio -> 1,
Axes -> True, ImageSize -> 230]
Alterantively, you can use combination of Scale
and Translate
:
Show[g1, Graphics @ Translate[Scale[First @ g2, 2], -{1, 1}/2],
AspectRatio -> 1, Axes -> True, ImageSize -> 230]
or
Show[g1, Graphics@Translate[Scale[First@g2, 2, {0, 0}], -{1, 1}],
AspectRatio -> 1, Axes -> True, ImageSize -> 230]
same picture
I'm not saying that this is what you need for your problem, but sometimes when you want to superimpose graphics like this, you're looking for Inset
:
Show[
g1,
Graphics@Inset[
Show[g2, PlotRangePadding -> 0],
{0, 0}, {Center, Center}, {2, 2}
],
Axes -> True, ImageSize -> 230
]