[Python-modules-commits] [python-mplexporter] 132/135: Create a canvas there is no canvas for the figure.

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 34b2bb75784d829bfdf86f5b490a92a31e10fdc4
Author: Yu Feng <rainwoodman at gmail.com>
Date:   Wed Sep 17 15:06:28 2014 -0700

    Create a canvas there is no canvas for the figure.
    
    If the figure is created from matplotlib.figure.Figure rather than pyplot.figure.
---
 mplexporter/exporter.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/mplexporter/exporter.py b/mplexporter/exporter.py
index 7df899a..75a0931 100644
--- a/mplexporter/exporter.py
+++ b/mplexporter/exporter.py
@@ -42,6 +42,9 @@ 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:
             import matplotlib.pyplot as plt

-- 
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