On Wed, Feb 3, 2010 at 2:01 PM, Jae-Joon Lee <lee.j.j...@gmail.com> wrote:
> Dear all,
>
> I just committed a small change that enables a user to register a
> custom backend that will be used with "savefig".
> For example,
>
> import matplotlib.backend_bases
> from matplotlib.backends.backend_ps import FigureCanvasPS, RendererPS
>
> class RendererPSCustom(RendererPS):
>    def draw_path(self, gc, path, transform, rgbFace=None):
>        print "custom draw path"
>        RendererPS.draw_path(self, gc, path, transform, rgbFace)
>
> class FigureCanvasPSCustom(FigureCanvasPS):
>    _renderer_class = RendererPSCustom
>
>    def print_eps_custom(self, outfile, *args, **kwargs):
>        print "Using Custome backend"
>        return self._print_ps(outfile, 'eps', *args, **kwargs)
>
>
> matplotlib.backend_bases.register_backend("eps_custom", FigureCanvasPSCustom)
>
> plt.plot([1,2,3])
> plt.savefig("a.eps", format="eps_custom") # this will save the file
> using  backend_ps_cmyk
>
>
> The api may need some cleanups or modifications, and any suggestion
> will be welcomed.
>
> Also committed is a some refactoring of ps backend but the change
> should be quite transparent.

I like it.  Out of curiosity, is there anything that this approach
brings (other than simplicity) that isn't already covered by the
support for:

matplotlib.use('module:://')

?

Ryan

-- 
Ryan May
Graduate Research Assistant
School of Meteorology
University of Oklahoma

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to