[Matrix-SIG] Re: Python Data Analysis and Plotting

David Ascher david_ascher@yahoo.com
Tue, 6 Apr 1999 08:48:36 -0700 (PDT)

--- "Anthony L. Wilson" <alwkappa@thinkapple.com> wrote:
> This is a follow-up message to the response to the topic "Using Python
> or Java for Data Analysis"
> It seems that there are two promising projects that may be of use for
> me: Snow and Piddle.  I am glad to see some work is still on-going in
> this area.  In looking at the other packages(
> http://www.python.org/topics/scicomp/plotting.html ), I could not find
> one that would fit the bill for running on both Linux and Mac OS.  The
> main reason for inquiring about plotting and such, is to create a set of
> tools that would complement MacSpice(
> http://home.earthlink.net/~wilsona/macspice.html) for plotting data and
> producing presentation quality output.  Yes, I know I could use Matlab,
> Igor Pro, IDL from Research Systems, Inc., or Excel( Arghh!!!), but I
> wanted something that would be portable across platforms (MacOS,
> Linux/Unix, Windows) as these are the machines I use most for my real
> work: circuit simulation, and freely available.
> Snow
> ------
> It seems Snow, developed by David Ascher, is further along in
> development for producing output and backend renderers. Thanks for the
> pointer David( http://starship.python.net:9673/crew/da/Snow ).  I liked
> the sample files.  They seem to be able to produce the multiple formats
> that I am looking for with the multiple axis style.  I will try to set
> this up on my Linux machine and test a few things.  If this works, I'll
> look into setting it up on my Mac.  The big hurdle for the Mac will be
> the use of PyPDF and PDFlib
> (http://www.ifconnection.de/~tm/software/pdflib/index.html ) that is
> used by Snow.  Any one planning/doing/done work in this area?? Let me
> know.

I plan on replacing the use of PDFlib with PDFgen, a Python-only framework
being developed by Andy Robinson.  In fact I already have a back-end for Snow
which uses PDFgen, but am waiting for release until PDFgen is upgraded to
include such features as rotated text and color control.  I don't expect
this to be a long-term problem.  In the meantime the PS/EPS back-end should
work fine on the mac.

> Questions on Snow:
> 1.  any comments on pursuing this for the Mac?  What do I need to set
> everything up?  i.e. MacPython Source, PIL source, PDFlib source,
> extension module setup, etc.

It depends on which back-end you wish to use.  For PS/EPS, all you
should need is NumPy. For bitmap output, PIL binaries should be ok
(but I don't know where they are -- you may need PIL 1.0b1 or later).

For PDF, I'd recommend waiting until PDFgen is available.

See comments below on a GUI/interactive version and the issues involved.

> 2.  Does Snow require PDFlib to produce GIF, JPEG, and PNG pictures or
> is this supported by PIL?

The latter.  PIL is great. =)

FYI#1: PIDDLE is quite promising -- I plan to provide a PIDDLE back-end
to Snow at some point -- there are some things which Snow needs which
Piddle doesn't provide in version 1.0 (such as arbitrary rotation of text
and clipping), but that won't be a problem for many plots.  

In other words, Snow and Piddle aren't mutually incompatible, and Piddle is probably
going to be a very good way to get Snow output on the mac (either the QD or Tkinter
back-end to piddle).  I'm willing to remove my back-ends and plug in Piddle if/when 
it's an appropriate replacement.  I haven't yet started work on said back-end.  (at
this point, I think that there are enough back-ends for Snow to be a good proof-of-
concept of the back-end architecture -- more urgent work lies elsewhere).

FYI#2: There is a very undocumented Piddle-like set of classes in Snow, which has
a similar approach but slightly different API, with more emphasis on multiple 
coordinate sets and "state-setting" objects, paths as 'higher-class' objects than in 
PIDDLE, etc.  Not at all to claim that the code in popy.py and *Device.py in Snow
is better than Piddle -- just a slightly different approach.

FYI#3: on the GUI front I have an PyOpenGL back-end for snow which is not ready for
distribution but which I've used in the past as part of a GUI for an interactive
function plotter (shown at the last IPC conference), and I may add a Tkinter-only
back-end if I can't fit the Piddle+Tk system in it neatly. My personal plans are to
build up a GUI which uses Tkinter for buttons and menus and the like and to use
PyOpenGL in a Tk window for the output/mouse input.  I find OpenGL to be both fast
and very high quality.  The only problem with OpenGL is that there is currently no
version of Togl (the OpenGL in a Tk widget widget) for the Mac.

Also FYI -- simple back-ends like PDFgen, PIL, and PS, take about 2 hours to get
90% of the functionality.  The part of the back-end which allows interactivity
is not yet that well defined.  The part of the back-end which knows about 3-D is

Further along the way lie plans for a GUI based on Swing+Java2D (or maybe 3D) output
on top of JPython.

I'd be curious to hear of any progress in getting Snow to work on the Mac,
and I'll try to help with such efforts, but I don't have access to a programming
setup on the mac, and my Mac hacking days predate my Python era.


PS: I am hoping to have quite a bit more time to devote to Snow in April/May.
    Expect to see the beginning of doc, code cleanup, and more graph types.
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com