[Python-modules-commits] [python-mplexporter] 109/135: Limiting legend drawing to _legend_box and legendPatch to vaoid duplicating objects
Wolfgang Borgert
debacle at moszumanska.debian.org
Tue Sep 23 21:19:09 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 11d5417f9d7aa700c30b8e40dc710ef6aa404201
Author: John Eppley <jmeppley at gmail.com>
Date: Wed Mar 26 10:55:35 2014 -0400
Limiting legend drawing to _legend_box and legendPatch to vaoid duplicating objects
---
mplexporter/exporter.py | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/mplexporter/exporter.py b/mplexporter/exporter.py
index 907cf05..90047d7 100644
--- a/mplexporter/exporter.py
+++ b/mplexporter/exporter.py
@@ -144,19 +144,19 @@ class Exporter(object):
props = utils.get_legend_properties(ax, legend)
with self.renderer.draw_legend(legend=legend, props=props):
if props['visible']:
- self.crawl_legend(ax, legend)
+ self.crawl_legend(ax, legend._legend_box)
+ if legend.draw_frame:
+ legend.legendPatch.set_zorder(1E6 +
+ legend.legendPatch.get_zorder())
+ self.draw_patch(ax, legend.legendPatch,
+ force_trans=ax.transAxes)
- def crawl_legend(self, ax, obj, used_objects=set()):
+
+ def crawl_legend(self, ax, obj):
"""
Recursively look through objects in legend children
"""
for child in obj.get_children():
- # skip things we've alread drawn
- if child in used_objects:
- continue
- else:
- used_objects.add(child)
-
# force a large zorder so it appears on top
child.set_zorder(1E6 + child.get_zorder())
@@ -171,7 +171,7 @@ class Exporter(object):
self.draw_line(ax, child, force_trans=ax.transAxes)
elif child.get_children() is not None \
and len(child.get_children())>0:
- self.crawl_legend(ax, child, used_objects=used_objects)
+ self.crawl_legend(ax, child)
else:
warnings.warn("Legend element %s not impemented" & child)
--
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