MathGroup Archive 2009

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

Search the Archive

Re: AxesLabel from expression

  • To: mathgroup at smc.vnet.net
  • Subject: [mg103856] Re: AxesLabel from expression
  • From: Nasser Abbasi <nma at 12000.org>
  • Date: Fri, 9 Oct 2009 07:17:43 -0400 (EDT)
  • References: <hakjrg$dd3$1@smc.vnet.net>

On Oct 8, 6:53 am, Elmar Nubbemeyer <elmar.nubbeme... at googlemail.com>
wrote:
> Hi,
>
> I am trying to construct an AxesLabel by using a combination of
> strings and previously defined variables. I have:
>
> mode = 1 (*this is changed ever so often*)
>
> Switch[mode,
>  0, sscript = "cert",
>  1, sscript = "auc",
>  2, sscript = "muc",
>  3, sscript = "adist",
>  4, sscript = "mdist"]
>
> plabel=Superscript["p",sscript]
> olabel=Superscript["o",sscript]
>
> I do this so I can, in this case, place the label "E(p^auc), E(o^auc)"
> on the Y-axis, where "^" of course means that the contents of the
> variable sscript is shown as a superscript of p or o.
>
> To do this in the Plot (2D), I tried different ways to define
> AxesLabel, and none of them worked:
>
> AxesLabel -> {"x", Print["E(", plabel, "),E(", olabel, ")"]}
>
> gives me what I want, but three times, row by row, like in a loop.
>
> AxesLabel -> {"x", "E(" <> ToString[plabel] <> "),E(" <> ToString
> [plabel] <>")"}
>
> removes the superscript formatting, and leads to a label: E(auc p), E
> (auc o)
>
> AxesLabel -> {"x", "E("plabel] "),E("olabel ")"}
>
> doesn't work either, it returns: )), E(E(p^auc o^auc
>
> Now I have run out of ideas on how to accomplish this. Any help is
> greatly appreciated.

I do not know if you meant by "E" above an the exponential function or
not. I assume not, here is one way to do it

mode = 1; Switch[mode, 0,
   sscript = "cert", 1,
   sscript = "auc", 2, sscript =
    "muc", 3, sscript = "adist", 4,
   sscript = "mdist"];

plabel = Superscript["p", sscript]
olabel = Superscript["o", sscript]

yLabel = Row[{"E(", plabel, "),E(", olabel, ")"}];

Plot[Sin[x], {x, -Pi, Pi},   AxesLabel -> {"x", yLabel}]

--Nasser



  • Prev by Date: Re: AxesLabel from expression
  • Next by Date: Re: Limiting the number of messages
  • Previous by thread: Re: AxesLabel from expression
  • Next by thread: undocumented feature: TableView