NB: I am aware that "plots" are graphics too, so the title would be more precisely worded if "graphics" were replaced by "non-plot graphics".
EDIT: I have edited my original example to make the problems with the solutions proposed so far more evident.
For example, let plot
be this plot:
plot = Plot[{0.5 Cos[4 Pi x], x}, {x, 0, 0.5}, ImageSize -> Small]
...and graphic
be this disk:
graphic = Graphics[{LightGray, Disk[{-1, -0.25}, 0.2]}, ImageSize -> Tiny, Frame->True]
I want to superimpose plot
and graphic
so that
- they share the same coordinate system (including aspect ratio)
- all the components of
plot
andgraphics
(including axes, frames, tick-marks, etc.) are represented in the resulting image.
More generally, I want to superimpose an arbitrary sequence of plots and graphics so that the two requirements above are satisfied.
Although this follows directly from (1), let me explicitly state that the ordering of the items in the sequence of plots and graphics should have no effect in the relative placement of the superimposed items.
The Overlay
command meets requirement 2 only:
Overlay[{graphic, plot}]
IMPORTANT: Even though the placement and proportions it produces are completely off, Overlay
gets right the aspect of faithfully preserving the axes, frames, ticks, etc. of its components.
The Show
command meets requirement 1 only:
Show[{graphic, plot}, ImageSize -> Small]
The frame in Show
's output is spurious: it does not correspond to graphic
's original frame. Furthermore, plot
's axes are gone.
A more subtle (and serious) problem with Show
is that it is not commutative:
Show[{plot, graphic}, ImageSize -> Small]
In this example, flipping the order of items in the call to Show
causes one of the items is no longer shown.
The result from Show
looks much closer to the desired result, but is missing plot
's axes, ticks, etc.
IOW, plot
's contribution to the final result should look like this:
Note, in particular, the extents of the axes.
NB: In this example, the x and y coordinates are scaled equally on the screen (and, therefore, in the desired final result, graphic
's disk looks circular and plot
's orange line has a 45-degree angle on the screen). In general, however, the scaling of the x and y coordinates need not be equal. The only requirement is that the scaling, whatever it is, applies equally to both plot
and graphic
.
Show[plot, graphic, PlotRange -> All, plot[[2]]]
? $\endgroup$plot[[2]]
,Options[plot]
can also be used. $\endgroup$FullGraphics
but it seems to be a abandoned function. I have tried a little bit to use it for your problem but it is not satisfactory $\endgroup$