# Overlay : zoom, graphic tools, get coordinates save as etc

I used Jens' legendmaker to Overlay graphics to get a nice legend on my ListPlot.

My question is if is there any way to make the output from Overlay behave like output from ListPlot in terms of the ability to zoom in to investigate, get co-ordinates, drawing tools, ability to right click on the graphic itself and save high resolution graphic as a host of things etc? I was able to right click the cell and save selection as a very low resolution jpeg.

Thanks,

EDIT:

boundaryplot = ListPlot[{H0SPlot, H0DPlot},PlotRange -> Full]
opts = Sequence[Background -> LightOrange, RoundingRadius -> 10];
labels = {"H0S", "H0D"}
Overlay[{boundaryplot, legendMaker[labels, opts]}, All, 1,Alignment -> {0.5, 0.5}]


While the Overlay options enable me to zoom in etc, when I right click on the image to save graphic as , I tried jpeg and pdf, it only saves the ListPlot and not the Legend. When I right click on the cell itself and use save selection as then I am able to save as jpeg something lower-res that also includes the legend.

-
I wouldn't be surprised if the answer was no. Why not make all the resizings, annotations, etc. on the list plot first before doing the overlay? That seems to work very well. –  The Toad Sep 24 '12 at 22:30
Have you looked at the second and third parameters to Overlay which let you specify which of the layers is interactable? –  amr Sep 24 '12 at 22:34
@amr Excellent! You should write that as an answer. Changing the Overlay call to something like Overlay[{plot, legend}, All, 1, Alignment -> {Right, Top}] allows you to interact with the graphics as usual. –  The Toad Sep 24 '12 at 22:46
... also see this related question on Overlay with multiple layers each with interactive content. –  kglr Sep 25 '12 at 2:06
Thanks Amr and RM! The wolfram more information barely touched upon what the 2nd and 3rd arguments do. I still don't understand what the second argument does. If either of you write up an answer then I'd be happy to accept it. Kguler, thanks for the link. that was very helpful. I don't know what I didn't find that myself. I should look harder. –  Amatya Sep 25 '12 at 2:20

Overlay's second parameter specifies which layers are visible and in what order. The third parameter specifies which layer can be interacted with. For your usage you can use the Overlay[layers, All, 1] form.

Here's a small demonstration for Overlay. I got a little carried away <_< but it should make clear what the second parameter can be used for.

shapes = {{Blue, Disk[]}, {Red, Rectangle[]}, {Yellow, Polygon[{{-1, -1}, {0, 1}, {1, -1}}]}};

indices = Range[Length[shapes]];
visibleChoices = MapIndexed[#1 -> Row[Graphics[#, ImageSize -> 20] & /@ Part[shapes, #1]] &, Subsets[indices]];
interactableChoices = MapIndexed[#2[[1]] -> Graphics[#1, ImageSize -> 20] &, shapes];

Manipulate[
Column@{"Overlay arguments",
Grid[{{Graphics[{Opacity[.7], #}, ImageSize -> 20] & /@ shapes,
direction[visible], interactable}}, Frame -> All, FrameStyle -> Lighter[Gray, .7]],

Overlay[Graphics[{Opacity[.7], #}] & /@ shapes,
direction[visible], interactable, Alignment -> Center]},

{{visible, indices}, visibleChoices},
{{direction, Identity}, {Identity -> ascending, Reverse -> descending}},
{{interactable, 0}, interactableChoices, ControlType -> SetterBar}]


Note: I didn't worry about preserving the user's adjustments. I think that would involve messing with ImageSize and PlotRange or other stuff and it would have complicated the demonstration.

Although I only implemented ascending/descending order, the second parameter can be any permutation, meaning you can arbitrarily reorder the layers.

-
oh man! Thats such a cool demonstration! Thank you. –  Amatya Sep 27 '12 at 5:38