MathGroup Archive 2012

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

Search the Archive

Re: format legend?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg129294] Re: format legend?
  • From: Bob Hanlon <hanlonr357 at gmail.com>
  • Date: Sat, 29 Dec 2012 15:13:06 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net
  • References: <20121228103323.1917C6895@smc.vnet.net>

Plot[
 Evaluate[
  Table[
   Tooltip[
    y = (b/(b + 1)) (n/(1 - n)),
    {n // N, y}],
   {n, 5/100, 4/10, 5/100}],
  {b, 0, 2}],
 PlotLegends -> Table[
   "n=" <> ToString[NumberForm[k, {3, 2}]],
   {k, 0.05, 0.40, 0.05}]]

However, the legend is "upside down" compared to the order of the
plots. Either of the following will realign the legends

Plot[
 Evaluate[
  Reverse[
   Table[
    Tooltip[
     y = (b/(b + 1)) (n/(1 - n)),
     {n // N, y}],
    {n, 5/100, 4/10, 5/100}]],
  {b, 0, 2}],
 PlotLegends ->
  Reverse[
   Table[
    "n=" <> ToString[NumberForm[k, {3, 2}]],
    {k, 0.05, 0.40, 0.05}]]]

Plot[
 Evaluate[
  Table[
   Tooltip[
    y = (b/(b + 1)) (n/(1 - n)),
    {n // N, y}],
   {n, 4/10, 5/100, -5/100}],
  {b, 0, 2}],
 PlotLegends -> Table[
   "n=" <> ToString[NumberForm[k, {3, 2}]],
   {k, .4, 0.05, -0.05}]]


Bob Hanlon


On Fri, Dec 28, 2012 at 5:33 AM, dabd <dario.rehman at gmail.com> 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?
>
> Thanks.
>



  • Prev by Date: Re: Problem with Expand and Modulus in Mathematica 9?
  • Next by Date: Re: Usage Messages in Mathematica
  • Previous by thread: format legend?
  • Next by thread: Re: format legend?