4
$\begingroup$

I use the following code to draw a parametric plot, with Epilog to add a point, and text using Graphics.

graf7 = ParametricPlot[  { delta18[t], delta2D[t]}, {t, 0, 800},
   Epilog -> {Red, PointSize[Large], 
     Point[{ delta18[0] , delta2D[0]} ], 
     Line[{{20, 160}, {-50, -400}}] } ,
   AspectRatio -> 1, PlotLabel -> "d18O vs dD (g/kgda)",
   PlotStyle -> Thick, PlotRange -> All, ImageSize -> Medium
   ];

Show[graf7,
  Graphics[Text["Dot is at surface", {-10.6, -89.4}]],
  Graphics[Text["Black line is MWL ", {-10.6, -89.6}]]  ]

For now, it works fine. I experimented with the equations that find the original arguments, delta18[t] and delta2D[t], so their value ranges change drastically, and the inserted text is no longer in the plot region.

How can I make the text appear at a relative position within the plot, so it is never outside the plot region?

$\endgroup$
14
$\begingroup$

You must use Scaled coordinates to position the text.

Example:

Manipulate[
 Plot[Sin[x], {x, 0, max},
  PlotRange -> 1.1 {-1, 1},
  Epilog -> {Text["sine", Scaled[{.2, .8}]]}],
 {max, 1, 20}
 ]
| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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