|
From: Darren D. <dd...@co...> - 2005-03-31 14:38:35
|
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
|