Steve M. Robbins wrote:

> I've read the manual but can't figure out how to access Python
> variables in the plot functions.  For example, I'd like to plot
> "sin(x + offset)" where offset is a variable.
> 
> What I'm actually trying to accomplish is to create a display like
> that shown in http://en.wikipedia.org/wiki/Phasor, except the sine
> wave is horizontal.  As a first step, I tried to create a static page
> with the two plots at a given offset (30 degrees).
> 
> Using the GUI, I created the attached file page-1.  Then I tried
> editing to produce attached file page-2, but to no avail.  Is there
> documentation or examples showing the python interface?

Hi - thanks for the question. The manual should have most of python 
interface documented. You can also look at the saved files for guidance. The 
documentation could be improved however.

There's also a more object-oriented new interface which is nicer to use, 
with some documentation here: http://barmag.net/veusz-wiki/EmbeddingPython

Veusz doesn't have direct access to Python variables, but you could either 
change the function to incorportate the variable, or define a constant which 
you use in the function.

With the new style API, you can change the function doing something like
Root.page1.graph1.function1.function.val = 'sin(3*x+%g)' % offset

Alternatively, you can use "offset" in your function and redefine it with 
the AddCustom command (accessed via Edit->Custom Definitions in GUI):

AddCustom('constant', 'offset', str(offset))

Jeremy



_______________________________________________
Veusz-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/veusz-discuss

Répondre à