Plotting package?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Andrew Koenig

    #1

    Plotting package?

    This may be a foolish question, but what's the most straightforward way to
    plot a bunch of data in Python?

    That is, I want to write a program that does some number crunching, and then
    I want to change some parameters and watch how the changes affect the
    results. I could produce a file to hand to gnuplot, but that's a bit of a
    pain; so I'm wondering if there is a widely used package to which I can give
    my x-y pairs and have it produce a graph for me with axes, scaling, etc.


  • danmcleran@yahoo.com

    #2
    Re: Plotting package?

    Try matplotlib, it's pretty nice and easy to use.

    Comment

    • Jorge Godoy

      #3
      Re: Plotting package?

      Andrew Koenig wrote:
      [color=blue]
      > This may be a foolish question, but what's the most straightforward way to
      > plot a bunch of data in Python?
      >
      > That is, I want to write a program that does some number crunching, and
      > then I want to change some parameters and watch how the changes affect the
      > results. I could produce a file to hand to gnuplot, but that's a bit of a
      > pain; so I'm wondering if there is a widely used package to which I can
      > give my x-y pairs and have it produce a graph for me with axes, scaling,
      > etc.[/color]

      I liked the output of PyChart. It is pretty easy to use. Also, I don't
      know what you're doing with numbers, but there's rpy to use with R.

      --
      Jorge Godoy <godoy@ieee.org >

      "Quidquid latine dictum sit, altum sonatur."
      - Qualquer coisa dita em latim soa profundo.
      - Anything said in Latin sounds smart.

      Comment

      • John Hunter

        #4
        Re: Plotting package?

        >>>>> "Andrew" == Andrew Koenig <ark@acm.org> writes:

        Andrew> This may be a foolish question, but what's the most
        Andrew> straightforward way to plot a bunch of data in Python?


        in matplotlib/pylab

        from pylab import figure, show
        x = range(10)
        y = [val**2 for val in x]
        fig = figure()
        ax = fig.add_subplot (111)
        ax.plot(x,y)
        ax.set_title('M y first plot')
        ax.set_xlabel(' x')
        ax.set_ylabel(' y')
        show()

        Tutorial: http://matplotlib.sourceforge.net/tutorial.html
        Screenshots: http://matplotlib.sourceforge.net/screenshots.html

        JDH

        Comment

        • Lou Pecora

          #5
          Re: Plotting package?

          In article <lgv3g.1444$xX5 .1193@bgtnsc05-news.ops.worldn et.att.net>,
          "Andrew Koenig" <ark@acm.org> wrote:
          [color=blue]
          > This may be a foolish question, but what's the most straightforward way to
          > plot a bunch of data in Python?
          >
          > That is, I want to write a program that does some number crunching, and then
          > I want to change some parameters and watch how the changes affect the
          > results. I could produce a file to hand to gnuplot, but that's a bit of a
          > pain; so I'm wondering if there is a widely used package to which I can give
          > my x-y pairs and have it produce a graph for me with axes, scaling, etc.[/color]

          I second all other recommendations on matplotlib.

          -- Lou Pecora (my views are my own) REMOVE THIS to email me.

          Comment

          • James Graham

            #6
            Re: Plotting package?

            Andrew Koenig wrote:[color=blue]
            > This may be a foolish question, but what's the most straightforward way to
            > plot a bunch of data in Python?
            >
            > That is, I want to write a program that does some number crunching, and then
            > I want to change some parameters and watch how the changes affect the
            > results. I could produce a file to hand to gnuplot, but that's a bit of a
            > pain; so I'm wondering if there is a widely used package to which I can give
            > my x-y pairs and have it produce a graph for me with axes, scaling, etc.
            >
            >[/color]
            In addition to the other (excellent) suggestions, you could have a look
            at Veusz [1]. It has a GUI which, in your case, you could use to create
            all the boilerplate code (axes, labels, etc.) interactively and then use
            the scripting interface to feed in different datasets as required. The
            major limitation is that it requires Qt/PyQt 3 so I don't know how easy
            it is to get working under Windows.

            [1] http://home.gna.org/veusz/

            Comment

            Working...