Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #12990 > unrolled thread

Re: format legend?

Started byBob Hanlon <hanlonr357@gmail.com>
First post2012-12-29 20:09 +0000
Last post2012-12-29 20:09 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: format legend? Bob Hanlon <hanlonr357@gmail.com> - 2012-12-29 20:09 +0000

#12990 — Re: format legend?

FromBob Hanlon <hanlonr357@gmail.com>
Date2012-12-29 20:09 +0000
SubjectRe: format legend?
Message-ID<kbniln$1d3$1@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@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.
>

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web