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.
Regards,
-JJ