Hello list,

Firstly, thank you to the developers, PyX is such a great tool. I have
been using it to plot large data files that other LaTeX oriented
plotting packages cannot handle.

As an example, attached is a script (and data files) for a plot of the
first 10 seconds of an electrocardiogram, and the derived heart rate
curve after processing.

I look forward to using PyX extensively. :)

--
Mansour Moufid
from pyx import *
from pyx.graph import axis
from pyx.style import linewidth

c = canvas.canvas()

g1 = c.insert(graph.graphxy(height=2, width=16,
                            x=graph.axis.lin(min=0,max=10,title="$t$ (s)"),
                            y=graph.axis.lin(min=0.625,max=0.875,
                                             title="$T$ (s)"),
                            y2=graph.axis.lin(min=95,max=70,
                                              title="$f$ (bpm)")))
g1.plot(graph.data.file("hr.dat", x=1, y=2), [graph.style.line()],
        [graph.style.line(lineattrs=[linewidth.Thin])])
g2 = c.insert(graph.graphxy(height=3,width=16,
                            x=graph.axis.linkedaxis(g1.axes["x"]),
                            y=graph.axis.lin(min=-2,max=3,title="$V$ (mV)"),
                            ypos=g1.height+0.5))
g2.plot(graph.data.file("ecg.dat", x=1, y=2), [graph.style.line()],
        [graph.style.line(lineattrs=[linewidth.Thin])])
g2.plot(graph.data.file("peaks.dat", x=1, y=2),
        styles=[graph.style.symbol(graph.style.symbol.circle, size=0.15)])
g3 = c.insert(graph.graphxy(height=3,width=16,
                            x=graph.axis.linkedaxis(g1.axes["x"]),
                            y=graph.axis.lin(min=-2,max=3,title="$V$ (mV)"),
                            ypos=g1.height+g2.height+1.0))
g3.plot(graph.data.file("ecg.dat", x=1, y=2), [graph.style.line()])

c.writePDFfile("ecg")

Attachment: ecg.dat.gz
Description: GNU Zip compressed data

Attachment: peaks.dat
Description: Binary data

Attachment: hr.dat
Description: Binary data

------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
PyX-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyx-user

Reply via email to