I have an issue about putting a legend consisted of a text and numerical value instead of a label.
For example, with this command line :
ωBD=9900;
pl = ListLinePlot[{ScaleFactorPast,ScaleFactorFuture},PlotStyle->{Blue,Blue},Frame->True,FrameLabel->{"t","a(t)"},LabelStyle->{FontSize->20,FontFamily->"Helvetica",Black,Bold},PlotRange->All, ImageSize->{600},Epilog->{Style[Text["Now",{0,1.4}],24],PointSize[.02],Point[{0, 1}]}, PlotLabel -> Row[{Subscript[ω, BD], "=", ωBD}]]
which generates the following plot :
Now, I would like to have the same label (text=omega_BD = numerical value associated) but in a legend box with same rendring than for the simple label printing.
I would like to put it either with a smart way (like in Python Matplotlib loc='best' or
at the bottom right (where there is some void).
I don't know how to perform this, i.e put the initial label into a legend with ListLinePlot function.
Any tracks or suggestions are welcome.
UPDATE 1 : This solution doesn't work :
pl = ListLinePlot[{ScaleFactorPast,ScaleFactorFuture},PlotStyle->{Blue,Blue},Frame->True,FrameLabel->{"t","a(t)"},LabelStyle->{FontSize->20,FontFamily->"Helvetica",Black,Bold},PlotRange->All, ImageSize->{600},Epilog->{Style[Text["Now",{0,1.4}],24],PointSize[.02],Point[{0, 1}]}];
legend =
LineLegend[{Black}, {Row[{Subscript[\[Omega], BD],
"=", \[Omega]BD}]},
LegendFunction -> (Framed[#, FrameMargins -> 0,
Background -> White] &),
LegendLabel ->
Style["The legend is shown on top", FontFamily -> "Helvetica", 17,
Blue],
LabelStyle -> {FontFamily -> "Helvetica", 24, Black, Italic, Bold}];
Legended[Show[pl], Placed[legend, {0, 1}]]
pics = Join[pics, {
Text[Style["Scale factor behavior for BD"], Background->Hue[0.45, 0.5, 1]],
pl
}];
Export["output/BD_plot.png", pl];
Pause[5]
see the result below :
No box legend appears, I have missed something but what ?
UPDATE 2: Here the results with you copy/paste code.
As you can see, only a black big point and the text "Now" appear, no box legend.
UPDATE 3 : the script generates a legend as expected but only Mathematica. Actually, from the beginning, I launch directly the script from command line terminal by doing :
$ wolframscript script_plot.wls
I would be curious to know why it works in Mathematica and not with wolframscript interpreter.
Maybe there is a workaround to get the same figure with wolframscript interpreter ?








differences between mathematica and wolframscript. I am just suggesting this so you can receive more attention to your issue. Also, the second option might be better for site maintenance bit the more experienced users should know better. $\endgroup$wolframscripton a mac and update the title of the question as well, so the rest of users are aware. It's a significant piece of information and in my opinion it should not be at the end of the question. That's the main issue. As you said, in aMathematicanotebook my suggested solution works ;) $\endgroup$