2

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?

lio
  • 2,396
  • 13
  • 26
  • @Kuba: The lower part of the string with the frame around is not fully seen. – lio Apr 24 '17 at 13:17
  • 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? – C. E. Apr 24 '17 at 13:19
  • 1
    @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. – lio Apr 24 '17 at 13:21
  • @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] – lio Apr 24 '17 at 13:37
  • Thank you Kuba. This is the solution. – lio Apr 24 '17 at 13:41
  • Try also this: Plot[Sin[x], {x, 0, 2 Pi}, Frame -> True, FrameTicks -> {{Automatic, None}, {{1, {2, Column[{Style["2", 12, Red], Style["string", 12, Red]}, Alignment -> Center]}, 3, 4, 5, 6}, None}}] and play with the Style. – Alexei Boulbitch Apr 24 '17 at 14:25

0 Answers0