MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: format legend?


On 12/28/12 at 5:33 AM, dario.rehman at gmail.com (dabd) wrote:

>Plot[Evaluate[{(b/(b + 1)) (n/(1 - n))} /.
>n -> Range[0.05, 0.40, 0.05]], {b, 0, 2}, PlotLegends ->
>Table[StringForm["n=``", ToString[k, InputForm, NumberMarks :>
>False]], {k, 0.05, 0.40, 0.05}]]

>How can I format the numbers in the legend with 2 decimal places?

Try NumberForm as in:

Plot[Evaluate[{(b/(b + 1)) (n/(1 - n))} /.
   n -> Range[0.05, 0.40, 0.05]], {b, 0, 2},
 PlotLegends ->
  Table["n=" <> ToString[NumberForm[k, {3, 2}]], {k, 0.05, 0.40,
    0.05}]]




  • Prev by Date: Re: Problem with Expand and Modulus in Mathematica 9?
  • Next by Date: Re: PlotLegends package obsolete?
  • Previous by thread: Re: format legend?
  • Next by thread: Syntax Coloring Issue