How to add the position of an added vertical line to the plot itself?

In this question it is answered how to add a vertical line to a graph. However, it has not been shown that how can someone add the position of that vertical line to the axis. How can I add the coordinate of a vertical line to the graph itself? I want to be able to change the font size of the coordinate too. By using the code below I can change the font size of the coordinate of axes. I want similar thing for the solution to this question too.

FrameStyle -> Directive[Black, Bold, 80]


Here is an example:

line3 = Line[{{2.33, -2}, {2.33, 2}}];
Plot[Sin[x], {x, 0, 2*Pi}, PlotStyle -> {Thick, Red}, Frame -> True, FrameStyle ->Directive[Thick, Bold, 20], Epilog -> {Directive[Thick, Blue], line3}]


Result:

• Can you provide the code for the Plot as well? And where you want your vertical line.
– Öskå
Jun 17, 2014 at 10:48
• @Öskå. I added more details.
– MOON
Jun 17, 2014 at 10:54
• FrameTicks -> {{0, 1, 2.33, 3, 4, 5, 6}, Automatic}? Jun 17, 2014 at 11:00
• Where should be the position of the vertical line located? I have this but it's ugly since everything is so huge.
– Öskå
Jun 17, 2014 at 11:01
• @Öskå. The position is not that much important. In this example I placed the vertical line at 2.33.
– MOON
Jun 17, 2014 at 11:03

The easiest way to accomplish this is to change the ticks (with FrameTicks) on the axes manually.

FrameTicks -> {{Automatic, Automatic}, {{0, 1, 2.33, 3, 4, 5, 6}, None}}


If you have a large number of ticks on your axes writing them down like this could be cumbersome, in which case you could try to generate the range and then replace another tick with the new tick or insert the extra tick that you want, like this:

{{Automatic, Automatic}, {Range[6] /. 2 -> 2.33, None}}


or

{{Automatic, Automatic}, {Insert[Range[6], 2.33, 3], None}}


Result:

One can then easily make it automatic (thank you Öskå for this code and animation):

line3[y_] := Line[{{y, -2}, {y, 2}}];
Manipulate[
Plot[Sin[x], {x, 0, 2 Pi}, PlotStyle -> {Thick, Red}, Frame -> True,
FrameStyle -> Directive[Thick, Bold, 20],
Epilog -> {Directive[Thick, Blue], line3[t]},
FrameTicks -> {{Automatic, Automatic}, {Range[0, 6] /. Round@t -> t, None}}], {t, 0, 6}]


• I added a more general case based on your idea, I hope you don't mind. If you do feel free to delete it :)
– Öskå
Jun 17, 2014 at 12:17
• @Öskå I think it's great, thank you! :) Jun 17, 2014 at 18:38
• Stop thanking me in public, I'm going to blush ;o) It's just that I was about the post this answer right after you posted yours, so I thought that I would put mine in yours.. :)
– Öskå
Jun 17, 2014 at 18:41

An answer with GridLines:

Plot[Sin[x], {x, 0, 2*Pi}, PlotStyle -> {Thick, Red}, Frame -> True,
FrameStyle -> Directive[Thick, Bold, 20],
GridLines -> {{2.33}, None},
GridLinesStyle -> Directive[Blue, Thick],
Epilog -> Text[Framed[2.33], {2.33, -0.9}, Background -> White]]


Manipulate[
Plot[Sin[x], {x, 0, 2*Pi}, PlotStyle -> {Thick, Red}, Frame -> True,
FrameStyle -> Directive[Thick, Bold, 20], GridLines -> {{m}, None},
GridLinesStyle -> Directive[Blue, Thick],
Epilog ->
Text[Framed[NumberForm[m, 3]], {m, -0.9},
Background -> White]], {m, 0, 2 Pi}]