Re: showing variables in plots?
- To: mathgroup at smc.vnet.net
- Subject: [mg70053] Re: showing variables in plots?
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Sun, 1 Oct 2006 04:10:02 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <efle9v$dds$1@smc.vnet.net>
Sam Waller 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
>
Hi Sam,
The following expression will do what you want:
txt = Graphics[Text["x = " <> ToString[x], {10, 10}, ....]];
Regards,
Jean-Marc