MathGroup Archive 2008

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

Search the Archive

Re: Constructing a Label

  • To: mathgroup at smc.vnet.net
  • Subject: [mg93365] Re: Constructing a Label
  • From: WetBlanket <Wyvern864 at gmail.com>
  • Date: Wed, 5 Nov 2008 04:53:14 -0500 (EST)
  • References: <gepb15$sfr$1@smc.vnet.net>

On Nov 4, 5:17 am, Nikolaus Rath <Nikol... at rath.org> wrote:
> Hello,
>
> I want to automatically construct labels of the form
> "A = <value of A>" for a number of plots.
>
> However, I cannot quite figure out how to generate the above
> expression. My first idea was to construct it as a string
>
> label = "A = " <> ToString[A]
>
> but this looks horribly if A is more complicated than just a single
> literal. So I assume that I have to "concatenate" the Mathematica
> expressions "A = " and A (rather than the stringified A). But how do I
> do that? My feeble attempts with
>
> label = RowBox["A", "=", A]
>
> are displayed exactly the way I entered them, i.e. with the literal
> "RowBox" printed out.
>
> Thanks in advance,
>
>    -Nikolaus
>
> --
>  =C2=BBIt is not worth an intelligent man's time to be in the major=
ity.
>   By definition, there are already enough people to do that.=C2=AB
>                                     =
                     -J.H. Hardy
>
>   PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6  02CF A9AD B7F8 AE4E 425C

You need to use StringForm.   Look at the Mathematica Documentation
for this command.

Example:
Plot[(A=5)*Sin[x],{x,-5,5},PlotLabel->Text[StringForm[" '1'  ",A]]
PlotLabel->Text[StringForm[" '1'  ",A]]


  • Prev by Date: Re: Tooltip ans Sound - 2nd posting
  • Next by Date: Re: Boundary problem with parameter using NDSolve
  • Previous by thread: Re: Constructing a Label
  • Next by thread: Re: Constructing a Label