# How to put the text inside of a plot

I want to plot this function,

cη0111ax[V_, X_] := 1/2 E^(-(1/2) Re[V X^2]) V^3 Abs[X/V]^2;

Plot[cη0111ax[4, X], {X, 0, t}
, PlotRange->{{0, 2}, {0, 1}}, Frame->True
, PlotLegends->{TextString@Row@{"X=", 1, "\n", "η=", cη0111ax[4, 1]*100, "%"}}
, Filling -> Axis
]


I use TextString Row@{"X=", t, "\n", "η=", cη0111ax[4, t]*100, "%"} to add a text that denotes the value x and cη0111ax[4, t] at point t. However, I can't put it inside of the figure. Adding a frame for text is also preferable. What can I do, thanks!

Moreover, hot to control the text format.

## 2 Answers

As my reputation is too low to comment, I'd like to respond with an answer:

You can use Placed and Scaled together with PlotLegends as following:

Plot[c\[Eta]0111ax[4, X], {X, 0, t},PlotRange->{{0, 2}, {0, 1}},Frame->True, PlotLegends->Placed[{TextString@Row@{"X=", 1, "\n", "\[Eta]=", c\[Eta]0111ax[4, 1]*100, "%"}}, Scaled[{0.8,0.9}]],Filling -> Axis]


The coordinates passed over to Scaled define the (relative) position of your legend.

• Great,Thank you! – YOUNGHI Mar 15 '17 at 11:08

Possible way

f[v_,x_]:=1/2 E^(-(1/2) Re[v x^2]) v^3 Abs[x/v]^2;
t=10;

Plot[f[4,x],{x,0,t},PlotRange->{{0,2},{0,1}},
PlotLegends->Placed[
LineLegend[{TextString@Row@{"X=",1,"\n","\[Eta]=",c\[Eta]0111ax[4,1]*100,"%"}},
LegendFunction->Frame,
LegendMarkerSize->{{55,10}}],{0.7,0.8}],
Frame->True,
Filling->Axis]


• Wonderful! Thank you! – YOUNGHI Mar 15 '17 at 11:11