# Adding Points on a Graphic

I have three questions about the following code:

Plot[{1/2 - 3/2 \[Lambda], Min[1/2 - 3/2 \[Lambda], Sqrt[\[Lambda]]]}, {\[Lambda], 0, 1/9}, AxesLabel -> {\[Lambda], \[Gamma]}, PlotStyle -> Black, Filling -> {1 -> {{2}, White}, 2 -> {Axis, Red}},  AxesStyle -> {Directive[Black], Directive[Blue]}, Epilog -> {Text[Style["FULLY ATTRACTIVE", 36], Scaled[{0.6, 0.25}]], Red}]


1. How can I plot a series of given points on the plot obtained by code shown? For example suppose I have the following series of points:

{{0.000297159,0.029389}, {0.00114653,0.0566384}, {0.00249252,0.082004},{0.00428816,0.105703} (* etc. *)}

2. Is there a more effective way to write the text "FULLY ATTRACTIVE" in the red region of the plot?

3. How can I change the axes dimension?

Thanks.

First thing let's plot the points

points = {{0.000297159, 0.029389}, {0.00114653,
0.0566384}, {0.00249252, 0.082004}, {0.00428816, 0.105703}(*etc.*)};


For that you can keep using Epilog while paying attention to make all its content a valid Graphics element:

plot = Plot[{1/2 - 3/2 \[Lambda],
Min[1/2 - 3/2 \[Lambda], Sqrt[\[Lambda]]]}, {\[Lambda], 0, 1/9},
AxesLabel -> {\[Lambda], \[Gamma]}, PlotStyle -> Black,
Filling -> {1 -> {{2}, White}, 2 -> {Axis, Red}},
AxesStyle -> {Directive[Black], Directive[Blue]},
Epilog -> {Orange, PointSize[.02], Point[points]}]


The result is

Your text can be fit into the red shape by making it a little smaller, but let's assume you don't want to manually find the good fit. A possibility is to use WordCloud to find a good layout for you (with the caveat that it's not preserving the ordering of the words, so this method is not valid in general for multi-words labels).

We need to define the appropriate mask:

mask = Binarize[
Plot[{1/2 - 3/2 \[Lambda],
Min[1/2 - 3/2 \[Lambda], Sqrt[\[Lambda]]]}, {\[Lambda], 0, 1/9},
AxesLabel -> {\[Lambda], \[Gamma]}, PlotStyle -> Black,
TicksStyle -> Transparent, AxesStyle -> Black,
Filling -> {2 -> {Axis, White}}, Background -> Black]]


Now we can compute the layout (Erosion is used to leave a little margin)

text = WordCloud["FULLY ATTRACTIVE", Erosion[mask, 5],
ColorFunction -> Black];


and use Overlay to compose it with the original plot without worrying too much about the coordinates

Overlay[{plot, text}]


• Thank you Batracos! Jul 13 '17 at 18:48
• +1. Nice application of WordCloud! Sep 12 '17 at 6:37
Plot[{1/2 - 3/2 \[Lambda],
Min[1/2 - 3/2 \[Lambda], Sqrt[\[Lambda]]]}, {\[Lambda], 0, 1/9},
AspectRatio -> 1,
AxesLabel -> {\[Lambda], \[Gamma]},
PlotStyle -> Black,
Filling -> {1 -> {{2}, White}, 2 -> {Axis, Red}},
AxesStyle -> {Directive[Black], Directive[Blue]},
Epilog ->
{Text[Style["FULLY ATTRACTIVE", 26], Scaled[{0.6, 0.25}]],
PointSize@0.02, Red, Point[{{0.00114653, 0.0566384},
{0.00114653, 0.0566384}, {0.00249252, 0.082004}, {0.00428816, 0.105703}}]}


(2) Change axes-dimension with AspectRatio