Bewildered graphs

Discussion in 'Python' started by Mark Fenbers, Jul 5, 2003.

  1. Mark Fenbers

    Mark Fenbers Guest

    I am investigating Python for the sake of ultimately generating hydrographs
    (such as this: http://ahps.erh.noaa.gov/iln/ahps/RiverDat/gifs/prgo1.png)
    on-the-fly from a web server cluster. I have not used Python previously and do
    not yet know if Python is very useful for this or if I am wasting my time.

    Quite frankly, I am a little bewildered. Not only is there Python, but there
    are many extention modules which cloud up my view as to what I will need.
    There's Scientific Python, which sounds promising, but there's also SciPy which
    in itself has gnuplot, xplt and plt modules. I know enough about gnuplot to
    know that it won't meet my needs because I need to be able to shade regions
    above certain values such as done in yellow on the example hydrograph (the link
    above). It also doesn't have many font options or the ability to place an image
    such as the NOAA logo.

    Can someone kindly guide me as to what I would most likely need to replicate the
    graph shown via the link above?

    Mark
     
    Mark Fenbers, Jul 5, 2003
    #1
    1. Advertising

  2. Mark Fenbers

    Guest

    On Sat, 5 Jul 2003, Mark Fenbers wrote:

    > I am investigating Python for the sake of ultimately generating hydrographs
    > (such as this: http://ahps.erh.noaa.gov/iln/ahps/RiverDat/gifs/prgo1.png)
    > on-the-fly from a web server cluster. I have not used Python previously and do
    > not yet know if Python is very useful for this or if I am wasting my time.
    >
    > Quite frankly, I am a little bewildered. Not only is there Python, but there
    > are many extention modules which cloud up my view as to what I will need.
    > There's Scientific Python, which sounds promising, but there's also SciPy which
    > in itself has gnuplot, xplt and plt modules. I know enough about gnuplot to
    > know that it won't meet my needs because I need to be able to shade regions
    > above certain values such as done in yellow on the example hydrograph (the link
    > above). It also doesn't have many font options or the ability to place an image
    > such as the NOAA logo.
    >
    > Can someone kindly guide me as to what I would most likely need to replicate the
    > graph shown via the link above?
    >


    Mark:

    NCL (http://www.cgd.ucar.edu/nclapps/gsn/) will do what you need. I've
    written a simple python module that allows you to embed NCL scripts in
    python code (http://www.cdc.noaa.gov/~jsw/python/pyncl.html).

    http://www.ccsm.ucar.edu/csm/support/CSM_Graphics/index.shtml has some
    nice NCL plotting examples.

    -Jeff


    --
    Jeffrey S. Whitaker Phone : (303)497-6313
    NOAA/OAR/CDC R/CDC1 FAX : (303)497-6449
    325 Broadway Web : http://www.cdc.noaa.gov/~jsw
    Boulder, CO, USA 80305-3328 Office: Skaggs Research Cntr 1D-124
     
    , Jul 5, 2003
    #2
    1. Advertising

  3. Mark Fenbers

    John J. Lee Guest

    Mark Fenbers <> writes:

    > I am investigating Python for the sake of ultimately generating
    > hydrographs (such as this:
    > http://ahps.erh.noaa.gov/iln/ahps/RiverDat/gifs/prgo1.png)
    > on-the-fly from a web server cluster. I have not used Python
    > previously and do not yet know if Python is very useful for this or
    > if I am wasting my time.


    I've done a lot of plotting with Python in the past. The issue is
    really which plotting package(s) you pick rather than anything to do
    with Python itself (and nobody here is likely to argue with your
    choice of language, of course!).


    > Quite frankly, I am a little bewildered. Not only is there Python,
    > but there are many extention modules which cloud up my view as to
    > what I will need.


    Certainly a year or two ago there was no single free plotting package
    around (Python or no Python) that was everything I needed -- and I was
    usually plotting pretty straightforward graphs. Things may have
    improved a bit since then, but I certainly think it's worth
    considering using a commercial package (from Python). Presumably you
    already use a package of some kind to plot these things? Most
    commercial packages seem to have an API of some sort, so try googling
    for a Python binding for it -- one may well already exist.

    Otherwise, I'm out of date so can't give you a simple 'use this', but
    in general:

    Just to confuse you further, another option is to use a generic
    plotting library, rather than one designed specifically for graphs.
    If the format of your graphs isn't going to change, that might be a
    reasonable choice. You end up with more code, but you avoid having to
    figure out how to tickle exactly what you want out of a reluctant
    plotting package. In particular, you can be sure you won't get stuck
    in the 'so far and no further' situation that graphing packages can
    leave you in.

    I'd probably first run though the demos that invariably come with the
    graphing packages, and if it wasn't fairly obvious that a) all the
    necessary features were there in one of them and b) reasonably clear
    the example code / docs c) lightweight enough not to bring your web
    server to its knees, I'd try a generic plotting library. Ordered by
    my guess of most appropriate first: PIL, PIDDLE, reportlab (nicer API
    than PIDDLE; pdf output, but you could probably convert to .png easily
    enough), plotutils, sketch.

    Of the graph plotting packages, some that should get the job done:

    Grace (grace_np.py)
    API documentation poor last time I looked, but does everything you
    could want, and has a (rather nasty) GUI interface too, so you can
    tweak graphs for publication. If load on the web server is high, it
    might be too heavyweight, though.

    DISLIN (pxDislin)
    You probably want the pxDislin binding, not the one distributed with
    DISLIN itself.

    Chaco
    Haven't used this. Probably a nice API, but looks like it's still
    not very capable.

    Lots of others too, I'm afraid: PLPLOT, PGPLOT, gnuplot, Qwt,
    scigraphica...


    > There's Scientific Python, which sounds promising, but there's also
    > SciPy which


    I haven't used the plotting software from either (I don't think
    Scientific Python had any plotting code when I used it). In general,
    they do different things. One obvious difference is that Scientific
    Python is (mostly, at least) new, pure Python code, where SciPy wraps
    a lot of old, well-tested Fortan, C and C++ code (but no doubt there's
    a fair amount of pure Python code there too). Both approaches have
    pros and cons, and the particular codes in SciPy and Scientific Python
    have different objectives, of course.


    John
     
    John J. Lee, Jul 5, 2003
    #3
  4. > [Mark Fenbers]
    > I am investigating Python for the sake of ultimately generating hydrographs
    > (such as this: http://ahps.erh.noaa.gov/iln/ahps/RiverDat/gifs/prgo1.png)
    > on-the-fly from a web server cluster.


    You are thinking about generating a .PNG or .JPG or .GIF or something
    like that?

    I have an idea: if your app is running on a web server cluster
    already, how about generating dynamic web pages displaying the graph.
    You could for example display this whole picture with SVG
    (http://www.w3.org/TR/SVG/ ). Even a simple CGI script in Python
    generating HTML plus CSS using "position: absolute" can do much like
    this. Note the BIG advantage of such a web application: everybody can
    use it with their browser; no installations, compilations,
    configurations. And the best way to generate SVG or HTML with Python
    from CGI is just using the string library and writing your own
    functions for things you notice you do often.

    [
    I *know* they plan to deprecate the string library. But most web
    hosting Pythons are still 1.5.2 :-!
    ]

    --
    Do you feel lucky punk?
    Make my day.
     
    Will Stuyvesant, Jul 5, 2003
    #4
  5. On Sat, 05 Jul 2003 08:07:24 -0400, Mark Fenbers <> wrote:

    >This is a multi-part message in MIME format.
    >--------------3C30E07F2D1A81BA8EE2E6DB
    >Content-Type: text/plain; charset=us-ascii
    >Content-Transfer-Encoding: 7bit
    >
    >I am investigating Python for the sake of ultimately generating hydrographs
    >(such as this: http://ahps.erh.noaa.gov/iln/ahps/RiverDat/gifs/prgo1.png)
    >on-the-fly from a web server cluster. I have not used Python previously and do
    >not yet know if Python is very useful for this or if I am wasting my time.
    >
    >Quite frankly, I am a little bewildered. Not only is there Python, but there
    >are many extention modules which cloud up my view as to what I will need.
    >There's Scientific Python, which sounds promising, but there's also SciPy which
    >in itself has gnuplot, xplt and plt modules. I know enough about gnuplot to
    >know that it won't meet my needs because I need to be able to shade regions
    >above certain values such as done in yellow on the example hydrograph (the link
    >above). It also doesn't have many font options or the ability to place an image
    >such as the NOAA logo.
    >
    >Can someone kindly guide me as to what I would most likely need to replicate the
    >graph shown via the link above?
    >

    Have you asked them what they use to generate it? If it's free software, chances are
    someone has done a Python interface (noaa.gov is paid for with taxes AFAIK, so it ought
    to be free at least for US citizens, IWT ;-)

    If not, it would at least make searching for a clone/workalike easier.

    Regards,
    Bengt Richter
     
    Bengt Richter, Jul 5, 2003
    #5
  6. Mark Fenbers

    Tim Churches Guest

    On Sat, 2003-07-05 at 22:07, Mark Fenbers wrote:
    > I am investigating Python for the sake of ultimately generating hydrographs
    > (such as this: http://ahps.erh.noaa.gov/iln/ahps/RiverDat/gifs/prgo1.png)
    > on-the-fly from a web server cluster. I have not used Python previously and do
    > not yet know if Python is very useful for this or if I am wasting my time..
    >
    > Quite frankly, I am a little bewildered. Not only is there Python, but there
    > are many extention modules which cloud up my view as to what I will need.
    > There's Scientific Python, which sounds promising, but there's also SciPy which
    > in itself has gnuplot, xplt and plt modules. I know enough about gnuplot to
    > know that it won't meet my needs because I need to be able to shade regions
    > above certain values such as done in yellow on the example hydrograph (the link
    > above). It also doesn't have many font options or the ability to place an image
    > such as the NOAA logo.
    >
    > Can someone kindly guide me as to what I would most likely need to replicate the
    > graph shown via the link above?


    There are indeed many options. But you might want to have a look at the
    delightfully named Ploticus (starring Russell Crowe...) at
    http://ploticus.sourceforge.net/doc/Welcome.html

    There is no Python interface for it, but Python is an ideal tool for
    building Ploticus scripts on-the-fly and running Ploticus to create the
    graphs on the Web server.

    However, Ploticus has recently become available as a callable library
    (libploticus) with a very simple C API which is just crying out for a
    Python wrapper - and a set of Python classes to abstract the interface
    on top of that. I would be happy to contribute to such a project, but am
    not able to undertake the construction of a C language wrapper.

    If you also need statistical analysis, I can recommend RPy (see
    http://rpy.sf.net) which embeds the R statistical package in Python. R
    does very, very nice graphics in all sorts of styles (see
    http://www.r-project.org), although it can be overkill for some Web
    server applications. Ploticus is very lightweight by comparison.

    --

    Tim C

    PGP/GnuPG Key 1024D/EAF993D0 available from keyservers everywhere
    or at http://members.optushome.com.au/tchur/pubkey.asc
    Key fingerprint = 8C22 BF76 33BA B3B5 1D5B EB37 7891 46A9 EAF9 93D0



    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.0.7 (GNU/Linux)

    iD8DBQA/B1uZeJFGqer5k9ARAncLAJ4qOgC4y2PGbTUXsLKlKb2qZ+BRgACgvN/1
    fjyfg7b63oxWQTwgb5kd17k=
    =bJlA
    -----END PGP SIGNATURE-----
     
    Tim Churches, Jul 6, 2003
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. DJ Miller

    Confused and bewildered.

    DJ Miller, Jul 31, 2003, in forum: ASP .Net
    Replies:
    4
    Views:
    1,083
    DJ Miller
    Sep 4, 2003
  2. srini
    Replies:
    0
    Views:
    1,745
    srini
    Jun 26, 2003
  3. Bruce Schechter

    line graphs via ASP.NET

    Bruce Schechter, Oct 19, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    634
    John Timney \(Microsoft MVP\)
    Oct 20, 2003
  4. Andrew de la Harpe

    Clickable bar graphs

    Andrew de la Harpe, Nov 3, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    382
    Agiato
    Nov 3, 2003
  5. John Doe
    Replies:
    3
    Views:
    305
    Tassilo v. Parseval
    Feb 17, 2004
Loading...

Share This Page