Re: AxesLabel from expression
- To: mathgroup at smc.vnet.net
- Subject: [mg103845] Re: AxesLabel from expression
- From: Albert Retey <awnl at gmx-topmail.de>
- Date: Fri, 9 Oct 2009 07:15:28 -0400 (EDT)
- References: <hakjrg$dd3$1@smc.vnet.net>
Elmar Nubbemeyer 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.
>
would this do what you need?
Plot[x, {x, 0, 1},
AxesLabel -> {"x", Row[{"E(", plabel, "), E(", olabel, ")"}]}
]
albert