I have the following plot:

dibA1 = Show[Plot[{PDF[eϕ1rand, x], PDF[eϕ1fps, x], PDF[eϕ1grad, x], PDF[eϕ1rank, x]}, 
      {x, 0, 1200}, 
      Frame -> True, 
      Filling -> None, 
      PlotLegends -> Placed[{"No Stigmergy", "FPS", "Gradient", "Rank"}, {0.85, 0.7}],
      FrameLabel -> {"Minutes", "Probability"}, 
      AspectRatio -> 0.8,
      LabelStyle -> {FontFamily -> "Times", 12}, 
      PlotRange -> {{0, 100}, All}, 
      PlotStyle -> 
        {Directive[Thick, Opacity[0.45], {Black}, Dashing[{0.045, 0.020}]], 
         Directive[Thick, Opacity[0.75], {Red}],
         Directive[Thick, Opacity[0.75], {Blue}, DotDashed],
         Directive[Thick, Opacity[0.75], {Green}, Dashing[{0.025, 0.014}]]}, 
      PlotLabel -> "Event 1"], 
      ImageSize -> 600]

I would like to place it in the same relative position but into the plot frame. I have been testing

Epilog -> Text[Style["Event1", 12], {0, -1}]

in different parts of the code and trying other text positions but I can not see any text into the plot frame.

How can I get to see the text "Event1" into the frame and determine its location?

  • 2
    $\begingroup$ Use Epilog -> Text[Style["Event1", 12], {45, -0.5}]]. The {45, -0.5} are the coordinates (relative to the axes) where the text will appear. $\endgroup$ Aug 8, 2017 at 13:45
  • $\begingroup$ Hi, Thank to answer me. I have tested the Epilog[] line but it does not show any text into the frame. $\endgroup$ Aug 8, 2017 at 14:55

2 Answers 2


Use scaled coordinates Scaled[{x,y}] for easier control. Scale runs $0<(x,y)<1$ independently of actual axes values, therefore not only it is easier to control, but also if you ever change the plot so axes values change, Scale will faithfully keep your text in the originally specified location relative to the Frame. Remember Style works in Text and hence in Epilog. Also next time your ask a question try to give a minimal code example, no need to overload the question with irrelevant code.

    Epilog->Text[Style["Hey There",Red,Italic,20],Scaled[{.5,.9}]]]

enter image description here

  • $\begingroup$ Thank you, it works fine. I will remember your comment next times. $\endgroup$ Aug 8, 2017 at 15:56
Legended[Plot[x Cos[x] Sin[x], {x, 0, Pi}, Frame -> True], 
 Placed[Style["Event 1", Red, Bold, 20], {Center, Top}]]

enter image description here

Use Placed[Style["Event 1", Red, Bold, 20], {.7, .9}] to get

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.