# Have plots labeled as "1." "0.75" "0.5" "0.25". Need plots labeled as "b=1.00" "b=0.75" "b=0.50" "b=0.25"

f is a function a single variable (x) and it depends on a parameter (b). It was plotted as shown below. I am looking for a modality to change the labels. Currently, the plots are labeled as "1." "0.75" "0.5" "0.25". I would like to include the symbol for the parameter in the label and to write each associated numerical value using two decimals, i.e., "b=1.00" "b=0.75" "b=0.50" "b=0.25".

f[x_] := ((1 + x^2) b)/2

Plot[Evaluate[Table[Labeled[f[x], b], {b, {0.25, 0.50, 0.75, 1.00}}]], {x, 0, 1}]

• Thanks, kglr! Good to know about PromptForm! I experimented wit PlotLabels prior to asking the question. My solution to getting to a similar (but less elegant) result was f[x_, b_] := ((1 + x^2) b)/2 Plot[{f[x, 0.25], f[x, 0.5], f[x, 0.75], f[x, 1]}, {x, 0, 1}, PlotLabels -> {"b=0.25", "b=0.50", "b=0.75", "b=1.00"}]. Your solution is superior. I will vote for Syed's solution. The grey handles are often helpful, but in this graph's case, they seem unnecessary, as the labels themselves fit nicely without the need for handles. Commented Aug 29, 2021 at 13:33
• Also, kglr: if I execute the code you shown below, I get an error: "Table::iterb: Iterator {b,blist} does not have appropriate bounds." Commented Aug 29, 2021 at 14:14
• Add blist = {0.25, 0.50, 0.75, 1.00}. Either comment under kglr's answer or use @kglr so that the user is notified.
– Syed
Commented Aug 29, 2021 at 15:17

f[x_] := ((1 + x^2) b)/2

Plot[Evaluate[
Table[Labeled[f[x],
"b=" <> ToString@NumberForm[b, {6, 2}]], {b, {0.25, 0.50, 0.75,
1.00}}]], {x, 0, 1}]


I would also encourage you to take a look at Callout.

• Thanks Syed! This is exactly what I was looking for. I explained above why. I don't think this graph needs handles, just the values of the parameter next to the plot. Mathematica: so many features... so little time (to learn of all of them) :--) Commented Aug 29, 2021 at 13:36
• @RainforestFrog I am happy that I was able to help you. Best of luck.
– Syed
Commented Aug 29, 2021 at 16:43

You can also use PromptForm + the optionPlotLabels as follows:

f[x_] := ((1 + x^2) b)/2

Plot[Evaluate[Table[f[x], {b, blist}]], {x, 0, 1},
PlotLabels -> (PromptForm["b", NumberForm[#, {5,2}]] & /@ blist)]


Note: Unfortunately, PromptForm is not documented.

Information @ PromptForm


Some examples:

Column[PromptForm[lefthandside, #] & /@ {Pi, 10^3, foo, blah}]