# How to label a grid line?

I am trying to label the vertical line in the right diagram. PlotLabels doesn't work.

Thank you for any solutions or hints!

Clear[y, a, k, l, c, mpl, mpk, lsupply]
y[a_, k_, l_, c_] := a k^c l^(1 - c)
lsupply[b_, m_, l_] := b + m l
mpl[a_, k_, l_, c_] := Evaluate@D[y[a, k, l, c], l]
mpk[a_, k_, l_, c_] := Evaluate@D[y[a, k, l, c], k]

ClearAll[lE, annotate]
lE = Cases[#, Point[x_] :> x[[1]], All] &;

annotate = ReplaceAll[p : Point[x_] :> {p, Dashed, {Text["E", #, {-1, -1.5}], Text["w", Offset[{5, 0}, {0, #[[2]]}], {-1, -1}], Text["N", Offset[{5, 5}, {#[[1]], 0}], {-1, -1}], Line[{{0, #[[2]]}, #, {#[[1]], 0}}]} &@x}];
annotate2 = ReplaceAll[p : Point[x_] :> {p, Dashed, {Text["E", #, {-1, -1.5}], Text["r", offset[{5, 0}, {0, #[[2]]}], {-1, -1}], Text["K", Offset[{5, 5}, {#[[1]], 0}], {-1, -1}], Line[{{0, #[[2]]}, #, {#[[1]], 0}}]} &@x}];

options1 = Sequence[PlotRange -> {25, 1000}, AxesLabel -> {"N", "MP, w"}, PlotLabel -> "Left Diagram", LabelStyle -> Black, ImageSize -> {400, 250}, MeshStyle -> Directive[Red, PointSize[Large]]];
options2 = Sequence[PlotRange -> {5, 125}, AxesLabel -> {"K", "MP, r"}, PlotLabel -> "Right Diagram", LabelStyle -> Black, MeshFunctions -> {# &}, MeshStyle -> Directive[Red, PointSize[Large]], ImageSize -> {400, 250}];

Manipulate[Row[
{annotate@(plt1 =
Normal@Plot[{mpl[a, k, l, c], lsupply[b, m, l]}, {l, 0, 100}, Evaluate@options1,
MeshFunctions -> {mpl[a, k, #, c] - lsupply[b, m, #] &},
Mesh -> {{0}}, PlotLabels -> {"NK:MP(A, K)", "N"}]),
annotate2@(plt1 =
Normal@Plot[mpk[a, kk, lE@plt1, c], {kk, 0, 1000},
Evaluate@options2, Mesh -> {{k}},
GridLines -> {{{k, Orange}}, None},
PlotLabels -> {"K:MP(A, N)"}])}],
{{a, 250, "TFP, A"}, 1, 400, 1, Appearance -> "Labeled"}, {{k, 350, "K", StandardForm}, 15, 1000, 5, Appearance -> "Labeled"}, {{c, 1/3}, 0.01, 0.99, 0.01, Appearance -> "Labeled"}, {{b, 150, "Shifting N", StandardForm}, 400, 0.002, 5}, {{m, 5, "Slope N", StandardForm}, 0.1, 25, 1}, {plt1, None}, TrackedSymbols :> {a, b, c, k, m}, ContentSize -> {900, 300}]


You can modify annotate2 to inject additional text and line primitives. That is, use

annotate2 = ReplaceAll[p : Point[x_] :>
{p, Dashed, {Text["E", #, {-1, -1.5}],
Text["r", Offset[{5, 0}, {0, #[[2]]}], {-1, -1}],
Text["K", Offset[{5, 5}, {#[[1]], 0}], {-1, -1}],
Line[{{0, #[[2]]}, #, {#[[1]], 0}}],
FontFamily -> "Arial", FontSize -> 10, FontWeight -> "Plain",
FontColor -> Black, FontOpacity -> 1,
Text["LABEL", Scaled[{.15, .7}, #], {-1, -1}],
Gray, Dashing[{}], AbsoluteThickness[1],
Line[{Scaled[{.13, .73}, #], Scaled[{.02, .7}, #]}]} &@x}];


to get

• Is there a possibility to match the formatting of the other labels created by PlotLabels? I tried font sizes 8 and 9 but the font/thickness looks different.
– Tom
Commented Mar 25, 2021 at 3:42
• @Tom, please see the updated version.
– kglr
Commented Mar 25, 2021 at 3:56