[Python-modules-commits] [python-mplexporter] 134/135: import FigureCanvasAgg at the top.

Wolfgang Borgert debacle at moszumanska.debian.org
Tue Sep 23 21:19:12 UTC 2014


This is an automated email from the git hooks/post-receive script.

debacle pushed a commit to branch master
in repository python-mplexporter.

commit 2f598b0b68526db2cb1ef2aeac3d67d771957a0b
Author: Yu Feng <rainwoodman at gmail.com>
Date:   Sun Sep 21 15:23:38 2014 -0700

    import FigureCanvasAgg at the top.
    
    the AGG backend of mpl should always be available thus
    it doesn't hurt to import it at the top of the module.
    
    We use the agg canvas as a 'fall-back' canvas to prepare the figure
    for the crawler -- in case the figure has no assigned canvas yet.
    
    (It may actually make sense to *always* use the agg backend,
    b/c the rendered image is discarded anyway and the agg backend is much
    faster than those with an X11 connection)
---
 mplexporter/exporter.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mplexporter/exporter.py b/mplexporter/exporter.py
index 75a0931..b83af7a 100644
--- a/mplexporter/exporter.py
+++ b/mplexporter/exporter.py
@@ -10,7 +10,7 @@ from . import utils
 
 import matplotlib
 from matplotlib import transforms, collections
-
+from matplotlib.backends.backend_agg import FigureCanvasAgg
 
 class Exporter(object):
     """Matplotlib Exporter
@@ -43,7 +43,6 @@ class Exporter(object):
         # Calling savefig executes the draw() command, putting elements
         # in the correct place.
         if fig.canvas is None:
-            from matplotlib.backends.backend_agg import FigureCanvasAgg
             canvas = FigureCanvasAgg(fig)
         fig.savefig(io.BytesIO(), format='png', dpi=fig.dpi)
         if self.close_mpl:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-mplexporter.git



More information about the Python-modules-commits mailing list