MathGroup Archive 2006

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

Search the Archive

Re: showing variables in plots?


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


  • Prev by Date: Re: subsets of a set
  • Next by Date: Re: Defining Solve results as variable
  • Previous by thread: Re: showing variables in plots?
  • Next by thread: Re: showing variables in plots?