Jeremy Sanders <jeremy@...> writes:

> 
> On 04/05/2013 04:26 AM, Steven hunyady wrote:
> 
> > Now I'd like to use embedded Veusz in a python program that captures the 
live
> > data itself. I added and modified the embedded example but my lack of
> > knowledge about Veusz and python has me puzzled about how to manipulate 
the
> > datasets. I'm currently using ImportString() to get one line of data at 
a
> > time (and veusz plots this one point), but I don't know how to append to 
this
> > data (instead of replacing it) when the next line is obtained.
> 
> You could keep a cumulative string, which you append the new line to, 
> and keep passing this to ImportString. However, this is probably much 
> less efficient than converting the data to numbers yourself and using 
> SetData, e.g.
> 
> datax = []
> datay = []
> for line in fileobject:
>    parts = line.split()
>    datax.append( float(parts[0]) )
>    datay.append( float(parts[1]) )
>    SetData('x', datax)
>    SetData('y', datay)
> 
> SetData avoids reconverting the data each time, creating temporary 
> copies of the data during parsing, and building up a very long string.
> 
> SetData has options for error bars. There is SetData2D for 2D datasets.
> 
> Hope this helps
> 
> Jeremy
> 

Many thanks! I saw this under "Reading other data formats" but now I 
understand its value.

My next puzzle is how to plot multiple columns of data. I see how it is done 
in the command line interface with a second xy plotter, but that does not 
appear to work in the embedded interface. I'll post the code if needed.

Thanks again. -sjh



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

Répondre à