Inset
Supports Offload
Inset[expr_, opts___]Inset[expr_, pos_List, origin: Center, opts___]Inset[expr_, pos_List, origin: Center, size_:Automatic, opts___]a graphics object, that allows to put another Graphics, Image, EditorView, CellView or anything else on the canvas.
Parameters:
poshas to be a 2D vector, that specifies the position of the inset in the local coordination systemoriginis optional and specifies the anchor:-
"Center"(default value)
-
"Top"
-
"Bottom"
-
"Left"
-
"Right"
-
{Center, Center}(default value)
-
{Left, Top}
-
- ...
-
{x, y}coordinates
-
sizeis optional and specifies the size of inner object in the system coordinates of the parent container (i.e.Graphics). If the specified size does not match the size of inner objectInsetwill be rescaled to match visually
Options
ImageSizeRaw
Sets the raw size in pixels {width, height} of the container for the inner object. It sometimes comes handy when it fails to automatically guess the required size. It works the best with origin set to {Left, Top}.
Examples
inset = Graphics[{
LightRed,
Disk[{0,0},0.25],
Black, Directive[FontSize->16], Text["Test", {0,0}, {0,0}]
}, PlotRange->{{-1,1}, {-1,1}}];
Plot[x, {x,0,10}, Epilog->{Inset[inset, {5,5}]}]set an anchor point:
inset = Graphics[{
LightRed,
Disk[{0,0},0.25],
Black, Directive[FontSize->16], Text["Test", {0,0}, {0,0}]
}, PlotRange->{{-1,1}, {-1,1}}, Background->Yellow, ImageSize->100];
Plot[x, {x,0,10}, Epilog->{Inset[inset, {5,5}, {Left, Top}]}]override size and distort the object:
inset = Graphics[{
LightRed,
Disk[{0,0},0.25],
Black, Directive[FontSize->16], Text["Test", {0,0}, {0,0}]
}, PlotRange->{{-1,1}, {-1,1}}, Background->Yellow, ImageSize->100];
Plot[x, {x,0,10}, Epilog->{Inset[inset, {5,5}, {Center, Center}, {1,1}]}]or use place any Wolfram expression:
Plot[x, {x,0,10}, Epilog->{Inset[HoldForm[(*FB[*)((1)(*,*)/(*,*)(2))(*]FB*)], {5,5}, Bottom]}] Rescale the object if needed:
g = Plot[Sin[x], {x, 0, 10}, Frame -> True, FrameTicks -> None,
AspectRatio -> Full];
Table[Graphics[{Inset[g, Automatic, Automatic, {s, s}],
Circle[{0, 0}, 2]}, Frame -> True, ImageSize->150], {s, {1, 2, 3}}]Transitions and updates
The second arguments pos that specifies the position of an inset does support updates.