I am learning a little about Inset, but after trying all options, I can't get this to work. I need to inset separately made Graphics2D
objects, into one main Graphics2D
but have them show up there with same relative sizes they had on their own. I use the Axes of the main Graphics as measuring stick yard to check that this is true.
For example, if I make disk of radius 1, and rectangle of width 6, and then Inset them to main Graphics, I expect them to show there with same relative sizes. Disk will still have radius 1 and the rectangle will still have width 6, but now when looking at the main Axes.
Here is an example:
g1 = Graphics[{LightGray, Disk[{0, 0}, 1]}, AspectRatio -> Automatic];
.ps the plot above is same code, but added Axes->True
to it for illustration. I do not use Axes
in the separate Graphics. But use Axes in the main Graphics.
g2 = Graphics[{Opacity[.5], Blue, Rectangle[{-3, -1}, {3, 1}]}, AspectRatio -> Automatic];
Now I want to insert the disk at origin of main Graphics, and insert the rectangle at location (2,2)
. But this is what happens when I do
Graphics[
{Inset[g1, {0, 0}],
Inset[g2, {2, 2}]
}, Axes -> True, PlotRange -> {{-6, 6}, {-4, 4}}, AspectRatio -> Automatic]
Looking at the above, the disk now shows with radius 2, and the rectangle became square. (relative the Axes of the main graphics). What I'd like to get is this: (did this manually, by adjusting the image sizes one by one after inserting)
I tried many options, but can't get the effect I want. Tried Scaled and changing aspect ratio setting, but did not help.
What is the correct way to inset graphics, so they show up with same axes limits/sizes as in the original graphics? but now will be relative to the main Graphics.