Re: showing variables in plots?
- To: mathgroup at smc.vnet.net
- Subject: [mg70036] Re: [mg70021] showing variables in plots?
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Sun, 1 Oct 2006 04:08:20 -0400 (EDT)
- Reply-to: hanlonr at cox.net
Use ToString[x]
x=2;
Plot[x^y, {y, 0, 5},
Epilog ->
{Text["x = " <> ToString[x], {1.5, 15}]}];
Bob Hanlon
---- Sam Waller <sam.waller at avmet.com> wrote:
> I'm plotting something like this:
>
> x = 2;
>
> curve = Plot[...., DisplayFunction -> Identity];
>
> txt = Graphics[ Text["x = 2", {10, 10},....] ];
>
> Show[curve, txt, DisplayFunctio->$DisplayFunction, ...];
>
> The problem is that I want 'txt' to automatically change if I assign a different value to x so that
> I don't have to edit txt everytime I change the variable x. Something like printf() in C. Can this
> be done in mathematica?
>
> thanks,
> Sam
>
--
Bob Hanlon
hanlonr at cox.net