Nothing much in the regards of the functionality.
It only provides a way to use custom backends with "savefig", which I
think is more convenient for interactive use. For example, with the
ps_cmyk backend that I'm playing with, the only thing that I  need to
do is to import the module (ps_cmyk) and call

savefig("test.eps", format="eps_cmyk")

And all other (interactive) work flow is not affected by the use of
the custome backend.
In non-interactive mode where a user explicitly calls
"matplotlib.use", there is no need to register a backend.

Regards,

-JJ



On Wed, Feb 3, 2010 at 4:15 PM, Ryan May <rma...@gmail.com> wrote:
> 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