>>>>> "Pierre" == Pierre GM <[EMAIL PROTECTED]> writes:

    Pierre> John, Thx for your answer. IMHO, the problem lies really
    Pierre> with Figure, not Canvas.  I'd need the Canvas, whatever
    Pierre> backend defines it, recognizes that the figure is not a
    Pierre> classical 'Figure' , but a subclass of it, with its own
    Pierre> special properties/methods.  I gonna think aloud for a
    Pierre> minute

I modified pylab (and every backend, damn there are a lot) to support
this feature.  Now you can pass a FigureClass kwarg to the pylab
figure function.  With minimal extra work, we could support defaults
so you don't have to explicitly pass it.  But before I go ahead with
this, take a look and see if this is more like what you had in mind.  

from pylab import figure, show, nx
from matplotlib.figure import Figure

class MyFigure(Figure):
    def __init__(self, *args, **kwargs):
        """
        custom kwarg figtitle is a figure title
        """
        figtitle = kwargs.pop('figtitle', 'hi mom')
        Figure.__init__(self, *args, **kwargs)
        self.text(0.5, 0.95, figtitle, ha='center')

fig = figure(FigureClass=MyFigure, figtitle='my title')
ax = fig.add_subplot(111)
ax.plot([1,2,3])
fig.savefig('test.png')
fig.savefig('test.ps')
show()
            



_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to