Hi,

On 17.02.06, Arnd Baecker wrote:
> I think you will have to split the plotting into parts, e.g.,
> if you have Numeric or numpy or numarray installed, you could do
> 
> #################################################
> from pyx import *
> from math import pi
> from Numeric import arange, cos
> 
> npts = 100
> x = pi/2.0*arange(npts)/(npts-1)
> y = cos(x)
> 
> g = graph.graphxy(width=8, height=3.25, xpos=0, ypos=8, x2=None, y2=None,
>                   x=graph.axis.lin(min=0, max=5, title="$t [s]$"),
>                   y=graph.axis.lin(min=-0.3, max=1.3, title="$U(t) [V]$"))
> for i in xrange(4):
>     g.plot(graph.data.list(zip(x+i*pi/2.0, y), x=1, y=2),
> [graph.style.line()])
> 
> g.writePDFfile("discont")
> ##################################################
> 
> Of course you can construct x and y as lists, but then
> adding i*pi/2.0 won't work.

Hey, that's pretty cool! I have a variant of that in case you don't
want the vertial lines (as it would be mathematically correct). You
can always insert "invalid" datapoints (everything that'll raise an
error in an axis convert method). Those invalid points will lead to
non-contiuous curves. In this case the y axis would be best to use,
since you don't need the math on it anymore and thus can make a list
from it (to enable different data types).

Just do the following

    x = pi/2.0*arange(npts)/(npts-2)
    y = list(cos(x))
    y[-1] = None

instead of the "x = ..." and "y = ..." lines above.


André

-- 
by  _ _      _    Dr. André Wobst
   / \ \    / )   [EMAIL PROTECTED], http://www.wobsta.de/
  / _ \ \/\/ /    PyX - High quality PostScript and PDF figures
 (_/ \_)_/\_/     with Python & TeX: visit http://pyx.sourceforge.net/


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
PyX-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyx-user

Reply via email to