Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Rightclick on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: Richard Langley <lang@un...>  20131210 03:54:37

In a Python script, I compute the value of a variable. Let's call it cep. I then want to draw a circle whose radius is cep. I would like to have something like cep = (some calculation producing a float value) g('set parametric') g('set trange [0:2*pi]') g('fx(t) = cep*cos(t)') g('fy(t) = cep*sin(t)') e = Gnuplot.Func('fx(t),fy(t)') g.plot(e) but that doesn't work, it seems, as gnuplot doesn't know the value of cep ("undefined variable: cep"). So how does one pass an arbitrary variable value to gnuplotpy?  Richard Langley   Richard B. Langley Email: lang@...   Geodetic Research Laboratory Web: http://gge.unb.ca   Dept. of Geodesy and Geomatics Engineering Phone: +1 506 4535142   University of New Brunswick Fax: +1 506 4534943   Fredericton, N.B., Canada E3B 5A3   Fredericton? Where's that? See: http://www.fredericton.ca/   
From: Michael Haggerty <mhagger@al...>  20131210 07:53:55

On 12/10/2013 04:54 AM, Richard Langley wrote: > In a Python script, I compute the value of a variable. Let's call it > cep. I then want to draw a circle whose radius is cep. I would like to > have something like > > cep = (some calculation producing a float value) > g('set parametric') > g('set trange [0:2*pi]') > g('fx(t) = cep*cos(t)') > g('fy(t) = cep*sin(t)') > e = Gnuplot.Func('fx(t),fy(t)') > g.plot(e) > > but that doesn't work, it seems, as gnuplot doesn't know the value > of cep ("undefined variable: cep"). So how does one pass an arbitrary > variable value to gnuplotpy? g('cep = %s' % (cep,)) There is no shortcut for this, but it wouldn't be difficult to build one. Michael  Michael Haggerty mhagger@... http://softwareswirl.blogspot.com/ 
From: Richard B. Langley <lang@un...>  20131210 14:26:28

Thanks, Michael. Works!  Richard On Tuesday, December 10, 2013,344, at 3:53 AM, Michael Haggerty wrote: > On 12/10/2013 04:54 AM, Richard Langley wrote: >> In a Python script, I compute the value of a variable. Let's call it >> cep. I then want to draw a circle whose radius is cep. I would like to >> have something like >> >> cep = (some calculation producing a float value) >> g('set parametric') >> g('set trange [0:2*pi]') >> g('fx(t) = cep*cos(t)') >> g('fy(t) = cep*sin(t)') >> e = Gnuplot.Func('fx(t),fy(t)') >> g.plot(e) >> >> but that doesn't work, it seems, as gnuplot doesn't know the value >> of cep ("undefined variable: cep"). So how does one pass an arbitrary >> variable value to gnuplotpy? > > g('cep = %s' % (cep,)) > > There is no shortcut for this, but it wouldn't be difficult to build one. > > Michael > >  > Michael Haggerty > mhagger@... > http://softwareswirl.blogspot.com/   Richard B. Langley Email: lang@...   Geodetic Research Laboratory Web: http://gge.unb.ca/   Dept. of Geodesy and Geomatics Engineering Phone: +1 506 4535142   University of New Brunswick Fax: +1 506 4534943   Fredericton, N.B., Canada E3B 5A3   Fredericton? Where's that? See: http://www.fredericton.ca/   
Sign up for the SourceForge newsletter:
No, thanks