0

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).

Karsten7
  • 27,448
  • 5
  • 73
  • 134
bobknight
  • 2,037
  • 1
  • 13
  • 15
  • Show[Graphics[Text],Plot[]]? – Feyre Sep 06 '16 at 08:57
  • 1
    Options[#, PlotRangeClipping] & /@ {Graphics, Plot} – Kuba Sep 06 '16 at 08:58
  • This is not due to ImageScaled. Use the PlotRangeClipping option to control whether elements outside the frame should be drawn. – Szabolcs Sep 06 '16 at 09:00
  • @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 – bobknight Sep 06 '16 at 09:10
  • However, the answer to the other question fits my question too, so I'll accept it. – bobknight Sep 06 '16 at 09:13
  • It is not 100% dupe but the answer is the same. And when a topic is marked a duplicate it is stated "this question is answered here:..." which will make it clear. – Kuba Sep 06 '16 at 09:13

0 Answers0