Re: PlotLabel
- To: mathgroup at smc.vnet.net
- Subject: [mg36333] Re: [mg36321] PlotLabel
- From: BobHanlon at aol.com
- Date: Mon, 2 Sep 2002 04:08:40 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 8/31/02 1:29:33 AM, giroux at dms.umontreal.ca writes:
> I plot several curve depending on a parameter p and I want the PlotLabel to
> show the value of p.
> What is wrong with the following ?
>
> pl[p_]:=Plot[Sin[x^p],{x,0,Pi},PlotLabel\[Rule] "p = " p,
> DisplayFunction\[Rule]Identity]
>
> Table[Show[pl[k],DisplayFunction\[Rule]$DisplayFunction],{k,3}]
>
Use ToString and StringJoin
pl[p_]:=Plot[Sin[x^p],{x,0,Pi},
PlotLabel->"p = " <> ToString[p],
DisplayFunction->Identity];
Alternatively, you could use StringForm
pl[p_]:=Plot[Sin[x^p],{x,0,Pi},
PlotLabel->StringForm["p = ``" , p],
DisplayFunction->Identity];
Bob Hanlon
Chantilly, VA USA