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

I have a ListLinePlot and I'm trying to place a close-up of a specific range in the ListLinePlot. Using overlay I solved this problem with:

Overlay[{p1, Item[Show[p2], Alignment -> {-.7, .6}]}]

This results in something like the following image:

Overlay example

But I can't select this image and export it. I can do "Print Selection as" and save as pdf, but this rasterizes the image. I want the same resolution as with a normal graphics environment. How do I achieve this?

share|improve this question
up vote 6 down vote accepted

Although Overlay preserves unrasterized copies of its constituent Graphics it is rasterized by the Front End for the purpose of display. Therefore I do not believe that you can use Overlay for this purpose.

However, I believe you can use Epilog and Inset:

p1 = Plot[Sinc[x], {x, 0, 10}];
p2 = BarChart[{{1, 2, 3}, {1, 3, 2}}];

 ImageSize -> 400,
 Epilog -> Inset[Show[p2, ImageSize -> 150], Scaled[{.6, .6}]]

enter image description here

You can also inset graphics manually. See:

share|improve this answer
Thanks, this works! FYI I used Show[p1, Epilog -> Inset[p2, {65, 300}]] in my case. I've seen that it can be done manually, but figured it could be done in mathematica code :). – user23127 Jul 28 '14 at 17:41

You can use Export[] when you cannot select outputs in the Front End.

Overlay[{p1, Item[Show[p2], Alignment -> {-.7, .6}]}]

saves the graphics as PDF in your current working directory. No rasterization happens.

This technique can also be used for output of GraphicsRow, GraphicsColumn, and GraphicsGrid where you cannot select whole the graphics.

share|improve this answer
You're right! Very interesting. – Mr.Wizard Aug 7 '14 at 6:14

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.