0
$\begingroup$

I have a Plot with an ImagePadding that leaves enought space outside the Frame where I want to write something. I want to use scaled coordinates, so I guess ImageScaled is what I need. Unfortunately, it works well for Graphics, not for Plot. See examples, where the first Plot/Graphics use ImageScaled and the second ones use Scaled:

{Plot[Sin[x], {x, -2, 2}, 
  ImageSize -> 400, 
  PlotRangePadding -> 1, 
  ImagePadding -> 50, 
  Frame -> True,
  Epilog -> {Text["ImageScaled", ImageScaled[{.1, .2}], {0, 1}]}],

 Plot[Sin[x], {x, -2, 2}, 
  ImageSize -> 400, 
  PlotRangePadding -> 1, 
  ImagePadding -> 50, 
  Frame -> True,
  Epilog -> {Text["ImageScaled", Scaled[{.1, .2}], {0, 1}]}]}

ImageScaled with Plot not working

As you can see in the first plot the text "ImageScaled" is not shown outside the framework, as it should do. For that is not correctly visible. While, using Graphics it works correctly:

{Graphics[{Text["ImageScaled", ImageScaled[{.1, .1}], {0, 1}], Circle[]}, 
          Frame -> True, 
          ImageSize -> 400, 
          PlotRangePadding -> 1, 
          ImagePadding -> 50 ],
 Graphics[{Text["ImageScaled", Scaled[{.1, .1}], {0, 1}], Circle[]}, 
          Frame -> True, 
          ImageSize -> 400, 
          PlotRangePadding -> 1, 
          ImagePadding -> 50 ]}

ImageScaled with Graphics

So, the question is: am I doing any mistake? Is there another approach I can use to write something outside the Frame of a Plot (e.g. in the area defined by ImagePadding).

$\endgroup$
  • $\begingroup$ Show[Graphics[Text],Plot[]]? $\endgroup$ – Feyre Sep 6 '16 at 8:57
  • 1
    $\begingroup$ Options[#, PlotRangeClipping] & /@ {Graphics, Plot} $\endgroup$ – Kuba Sep 6 '16 at 8:58
  • $\begingroup$ This is not due to ImageScaled. Use the PlotRangeClipping option to control whether elements outside the frame should be drawn. $\endgroup$ – Szabolcs Sep 6 '16 at 9:00
  • $\begingroup$ @Kuba (and Szabolcs) thanks, PlotRangeClipping is the explanation. Not sure if my question is exactly the same of the other you mention. I didn't read it before, however, my perplexity was related to ImageScaled. Because it uses the space outside the Frame, I was sure it was forcing PlotRangeClipping, but it was not. If you feel the question is the same, please close this one, no problem for me. Thanks again for the help $\endgroup$ – bobknight Sep 6 '16 at 9:10
  • $\begingroup$ However, the answer to the other question fits my question too, so I'll accept it. $\endgroup$ – bobknight Sep 6 '16 at 9:13