2
$\begingroup$

I want to place a string in a plot by using data coordinates.

I tried the following:

Plot[Sin[x], {x, 0, 2 Pi}, Frame -> True, Epilog -> Inset[Grid[{{"string"}}, 
  Frame -> All], {2, -1.1}]]

The problem is that "string" is not any more seen, since it is out of plot range.

enter image description here

How can I place a single string at any position inside or outside the plot frame, by using data coordinates?

$\endgroup$
  • $\begingroup$ @Kuba: The lower part of the string with the frame around is not fully seen. $\endgroup$ – lio Apr 24 '17 at 13:17
  • $\begingroup$ ok, so if I understand this correctly: You want the plot range to adapt so that it includes the string, wherever you have placed it? $\endgroup$ – C. E. Apr 24 '17 at 13:19
  • 1
    $\begingroup$ @C. E. What should I do to place the string for example below the value 2 at the horizontal axis? The plot range should not be changed. $\endgroup$ – lio Apr 24 '17 at 13:21
  • $\begingroup$ @Kuba: PlotRangeClipping -> False helps not if I want to use e.g. Plot[Sin[x], {x, 0, 2 Pi}, Frame -> True, Epilog -> Inset[Grid[{{"string"}}, Frame -> All], {2, -1.35}], PlotRangeClipping -> False] $\endgroup$ – lio Apr 24 '17 at 13:37
  • $\begingroup$ Thank you Kuba. This is the solution. $\endgroup$ – lio Apr 24 '17 at 13:41

Browse other questions tagged or ask your own question.