Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If I draw graphics like this, I get exactly what I need:

Graphics[{{Blue, Disk[{0, 0}, 10, {0, Pi/2}]}, {Red, 
   Disk[{0, 0}, 3, {0, Pi/4}]}}]

enter image description here

But I need to accomplish this task with Overlay[]. Here's the code:

graphics1 = Graphics[{Red, Disk[{0, 0}, 3, {0, Pi/4}]}];  
graphics2 = Graphics[{Blue, Disk[{0, 0}, 10, {0, Pi/2}]}];  
Overlay[{graphics2, graphics1}]

And I get this as output:
enter image description here

How can I position these graphics according to coordinates?
Thank you for any suggestions or answers.

share|improve this question
Why does it have to be Overlay specifically? I think what you are looking for combining multiple Graphics objects to one, for which Overlay is not the right function. – David Jan 18 '12 at 0:41
Indeed it does not have to be 'Overlay', I didn't think of 'Show' – balboa Jan 18 '12 at 11:46
up vote 6 down vote accepted

Can you use Show? It produces the same thing as your first plot:

Graphics1 = Graphics[{Red, Disk[{0, 0}, 3, {0, Pi/4}]}];  
graphics2 = Graphics[{Blue, Disk[{0, 0}, 10, {0, Pi/2}]}];  
Show[{graphics2, graphics1}]

Mathematica graphic

If you want to add other options, it works as well:

Show[{graphics2, graphics1}, PlotRange->{{-10, +10}, {-10, +10}}]

Mathematica graphic

You should note that Show is order dependent. It draws it in the order that's specified

share|improve this answer
Thank you, that solved my problem. – balboa Jan 18 '12 at 11:48
@balboa Hi, seems you forgot to accept this answer :) – ssch Sep 13 '13 at 0:32

You can get the desired result using a combination of ImageSize in the original image and the Alignment option in Overlay. (I am not 100% sure why the alignment isn't quite right.)

graphics1 = 
 Graphics[{Red, Disk[{0, 0}, 3, {0, Pi/4}]}, ImageSize -> 100]; 
graphics2 = 
 Graphics[{Blue, Disk[{0, 0}, 10, {0, Pi/2}]}, ImageSize -> 250]; 
Overlay[{graphics2, graphics1}, Alignment -> Bottom]

enter image description here

The issue here is that overlay will set the sizes of the two images to be the same if it has no information requiring it to do otherwise. So the coordinate systems of the two graphics can differ. This is why Show works more seamlessly here: it forces the two graphics to have the same coordinate system.

share|improve this answer
I encountered the same problem with Alignment, but you're right Show is much more appropriate approach than Overlay is for this task, thank you for answer – balboa Jan 18 '12 at 12:01
You can improve the alignment with PlotRangePadding -> None on both graphics – Simon Woods Oct 19 '14 at 11:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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