Take an example as follows:

img = ExampleData[{"TestImage", "Clock"}];
plt = Graphics[{Red, Arrowheads[.1], Thickness[.02] , 
           Table[Arrow[{{0, 0}, {Sin[i], Cos [i]}}], {i, 0, Pi, 1}]},
           Epilog -> Inset[img]]

which produce an image as:

test image


I want to overlay the img under the arrows, not above them. It's best to use Epilog->Inset[] method.

Thank you.


I have researched Overlay[]. It can configure the layers,but it fails to set the position.


Use Prolog->Inset[..] instead of the Epilog

  • $\begingroup$ Exactly!! That's the very thing I wish. $\endgroup$
    – PureLine
    Jul 28 '18 at 8:16

You can also use Overlay where the order of the list dictates the order of the layers.

img = ExampleData[{"TestImage", "Clock"}];
plt = Graphics[{Red, Arrowheads[.1], Thickness[.02], 
   Table[Arrow[{{0, 0}, {Sin[i], Cos[i]}}], {i, 0, Pi, 1}]}]

Overlay /@ Permutations[{img, plt, Text[Style["text", Blue]]}, {3}]

Mathematica graphics

  • $\begingroup$ thank you. but I found that Overlay[] does not have an option to configure the position of an inset. Do you have any ideas about setting the position? $\endgroup$
    – PureLine
    Jul 28 '18 at 12:12
  • $\begingroup$ @PureLine If you had provided, in your question, a particular example of the alignment you need, I would have shown how to use Alignment option. $\endgroup$
    – rhermans
    Jul 28 '18 at 13:08
  • $\begingroup$ thanks to your hint. I have managed it. Overlay[{plot, image},{2,1}, Alighment->{x,y}], which will put the image above plot. $\endgroup$
    – PureLine
    Jul 28 '18 at 14:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.