plotting two lists

i'd just like to ask how to make a simple graph of two lists???
i've seen this in the tutorials...

a = self.fig.add_subplot(111)
t = numpy.arange(0.0,3.0,0.01)
s = numpy.sin(2*numpy.pi*t)
c = numpy.cos(2*numpy.pi*t)
a.plot(t,s)
a.plot(t,c)

···

=============
so if i am to plot two lists say listY[] and listX[], i should do this:

a.plot(listY, listX)

=============

please, any help will be greatly appreciated!

ok, so i've done plotting two list on boa/wxpython
now, i want to add labels and everything else to my graph...
adding labels i've done this:

      self.figure = Figure()
      self.axes = self.figure.add_subplot(111)
       
      self.axes.plot(parent.listX,parent.listY, 'bo')
      
      self.axes.xlabel(parent.Xaxis.GetStringSelection())
      self.axes.ylabel(parent.Xaxis.GetStringSelection())
      
      self.canvas = FigureCanvas(self, -1, self.figure)

···

===========================================
but i'm getting some error that says:
Traceback (most recent call last):
  File "E:\final docu\Folder4.2pssl2\wxFrame1.py", line 729, in
OnGraphOldFileButton
    wxFrame2.create(self).Show(true)
  File "E:\final docu\Folder4.2pssl2\wxFrame2.py", line 16, in create
    return wxFrame2(parent)
  File "E:\final docu\Folder4.2pssl2\wxFrame2.py", line 39, in __init__
    self.axes.xlabel(parent.Xaxis.GetStringSelection())

AttributeError: Subplot instance has no attribute 'xlabel'

==============================================
what should i do???

Hi Jan,

axes.xlabel doesnt exist. What you are looking for is

self.axes.set_xlabel(parent.Xaxis.GetStringSelection())
self.axes.set_ylabel(parent.Xaxis.GetStringSelection())

The Matplotlib devs have put a lot of effort into documenting the project. In
situations like this, I often end up relying on the python interactive
interpreter to find the method I am looking for:

from pylab import *
fig = figure()
ax = fig.add_subplot(111)
dir(ax)

or you could add a line in your own code:

      self.figure = Figure()
      self.axes = self.figure.add_subplot(111)

      self.axes.plot(parent.listX,parent.listY, 'bo')
      print dir(self.axes)

both would give you a list of available methods.

Hope this helps,

Darren

···

On Thursday 31 March 2005 04:34 am, Jan Rienyer Gadil wrote:

ok, so i've done plotting two list on boa/wxpython
now, i want to add labels and everything else to my graph...
adding labels i've done this:

      self.figure = Figure()
      self.axes = self.figure.add_subplot(111)

      self.axes.plot(parent.listX,parent.listY, 'bo')

      self.axes.xlabel(parent.Xaxis.GetStringSelection())
      self.axes.ylabel(parent.Xaxis.GetStringSelection())

      self.canvas = FigureCanvas(self, -1, self.figure)

===========================================
but i'm getting some error that says:
Traceback (most recent call last):
  File "E:\final docu\Folder4.2pssl2\wxFrame1.py", line 729, in
OnGraphOldFileButton
    wxFrame2.create(self).Show(true)
  File "E:\final docu\Folder4.2pssl2\wxFrame2.py", line 16, in create
    return wxFrame2(parent)
  File "E:\final docu\Folder4.2pssl2\wxFrame2.py", line 39, in __init__
    self.axes.xlabel(parent.Xaxis.GetStringSelection())

AttributeError: Subplot instance has no attribute 'xlabel'

==============================================
what should i do???

thanks to you all, that's a really big help!!!

···

On Thu, 31 Mar 2005 09:38:26 -0500, Darren Dale <dd55@...163...> wrote:

On Thursday 31 March 2005 04:34 am, Jan Rienyer Gadil wrote:
> ok, so i've done plotting two list on boa/wxpython
> now, i want to add labels and everything else to my graph...
> adding labels i've done this:
>
> self.figure = Figure()
> self.axes = self.figure.add_subplot(111)
>
> self.axes.plot(parent.listX,parent.listY, 'bo')
>
> self.axes.xlabel(parent.Xaxis.GetStringSelection())
> self.axes.ylabel(parent.Xaxis.GetStringSelection())
>
> self.canvas = FigureCanvas(self, -1, self.figure)
>
> ===========================================
> but i'm getting some error that says:
> Traceback (most recent call last):
> File "E:\final docu\Folder4.2pssl2\wxFrame1.py", line 729, in
> OnGraphOldFileButton
> wxFrame2.create(self).Show(true)
> File "E:\final docu\Folder4.2pssl2\wxFrame2.py", line 16, in create
> return wxFrame2(parent)
> File "E:\final docu\Folder4.2pssl2\wxFrame2.py", line 39, in __init__
> self.axes.xlabel(parent.Xaxis.GetStringSelection())
>
> AttributeError: Subplot instance has no attribute 'xlabel'
>
> ==============================================
> what should i do???

Hi Jan,

axes.xlabel doesnt exist. What you are looking for is

self.axes.set_xlabel(parent.Xaxis.GetStringSelection())
self.axes.set_ylabel(parent.Xaxis.GetStringSelection())

The Matplotlib devs have put a lot of effort into documenting the project. In
situations like this, I often end up relying on the python interactive
interpreter to find the method I am looking for:

from pylab import *
fig = figure()
ax = fig.add_subplot(111)
dir(ax)

or you could add a line in your own code:

      self.figure = Figure()
      self.axes = self.figure.add_subplot(111)

      self.axes.plot(parent.listX,parent.listY, 'bo')
      print dir(self.axes)

both would give you a list of available methods.

Hope this helps,

Darren