I wrote a little function to add lines with labels to plots. It just creates customized {GridLines -> ..., Epilog -> ...}
code:
LastOrEmpty[seq_] := If[Length[seq] > 0, Last[seq], {}];
AddLabel[lab_, pos_] :=
Inset[Framed[lab, Background -> White, FrameStyle -> None], pos];
AddLines[xs_, ys_, xlvl_, ylvl_] := {
GridLines -> {LastOrEmpty /@ xs, LastOrEmpty /@ ys},
Epilog -> Join[
Table[AddLabel[xs[[i, 1]], {xs[[i, 2]], ylvl}], {i, Length[xs]}],
Table[AddLabel[ys[[i, 1]], {xlvl, ys[[i, 2]]}], {i, Length[ys]}]
]
};
But is using a little creepy syntax:
AddLines[
{label1 -> val1, label2 -> val2, ...}, (* <- vertical lines *)
{label3 -> val3, label4 -> val4, ...}, (* <- horizontal lines *)
xlvl, (* <- Horisontal align of labels*)
ylvl (* <- Vertical align of labels*)
] // Evaluate
For example:
ParametricPlot[{x1[w],
x3[w]}, {w, w1 - 5, w1 + 9},
AspectRatio -> 1/GoldenRatio,
AxesOrigin -> {0.10, 0},
AxesLabel -> {"x1(\[Omega])", "x3(\[Omega])"},
GridLinesStyle -> Dashed,
AddLines[
{T1 -> 0.2},
{K1 -> 2, Kgr -> 0.52, Baseline -> 1},
0.59, 2.9] // Evaluate
]
Now I would like to write something like:
Lines -> {
{T1 -> 0.2},
{K1 -> 2, Kgr -> 0.52, Baseline -> 1},
0.59, 2.9}
And at the best I would like to make it to automatically calculate align, i.e. would look like:
Lines -> {
{T1 -> 0.2},
{K1 -> 2, Kgr -> 0.52, Baseline -> 1}}
Have you any idea how to make it?