[Python-modules-commits] [python-mplexporter] 70/135: add text_type argument to draw_text
Wolfgang Borgert
debacle at moszumanska.debian.org
Tue Sep 23 21:19:05 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 81108226ec77af545d3a6eb377a77b2615130721
Author: Jake Vanderplas <vanderplas at astro.washington.edu>
Date: Sat Mar 1 07:20:42 2014 -0800
add text_type argument to draw_text
---
mplexporter/exporter.py | 9 ++++++---
mplexporter/renderers/base.py | 5 ++++-
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/mplexporter/exporter.py b/mplexporter/exporter.py
index 982e250..9d37cde 100644
--- a/mplexporter/exporter.py
+++ b/mplexporter/exporter.py
@@ -123,9 +123,11 @@ class Exporter(object):
self.draw_line(ax, line)
for text in ax.texts:
self.draw_text(ax, text)
- for text in [ax.xaxis.label, ax.yaxis.label, ax.title]:
+ for (text, ttp) in zip([ax.xaxis.label, ax.yaxis.label, ax.title],
+ ["xlabel", "ylabel", "title"]):
if(hasattr(text, 'get_text') and text.get_text()):
- self.draw_text(ax, text, force_trans=ax.transAxes)
+ self.draw_text(ax, text, force_trans=ax.transAxes,
+ text_type=ttp)
for artist in ax.artists:
# TODO: process other artists
if isinstance(artist, matplotlib.text.Text):
@@ -174,7 +176,7 @@ class Exporter(object):
coordinates=coordinates,
style=markerstyle, mplobj=line)
- def draw_text(self, ax, text, force_trans=None):
+ def draw_text(self, ax, text, force_trans=None, text_type=None):
"""Process a matplotlib text object and call renderer.draw_text"""
content = text.get_text()
if content:
@@ -186,6 +188,7 @@ class Exporter(object):
style = utils.get_text_style(text)
self.renderer.draw_text(text=content, position=position,
coordinates=coords,
+ text_type=text_type,
style=style, mplobj=text)
def draw_patch(self, ax, patch, force_trans=None):
diff --git a/mplexporter/renderers/base.py b/mplexporter/renderers/base.py
index 828f3d2..d73fc99 100644
--- a/mplexporter/renderers/base.py
+++ b/mplexporter/renderers/base.py
@@ -253,7 +253,8 @@ class Renderer(object):
offset=vertex, offset_coordinates=coordinates,
mplobj=mplobj)
- def draw_text(self, text, position, coordinates, style, mplobj=None):
+ def draw_text(self, text, position, coordinates, style,
+ text_type=None, mplobj=None):
"""
Draw text on the image.
@@ -268,6 +269,8 @@ class Renderer(object):
or 'figure' for figure (pixel) coordinates.
style : dictionary
a dictionary specifying the appearance of the text.
+ text_type : string or None
+ if specified, a type of text such as "xlabel", "ylabel", "title"
mplobj : matplotlib object
the matplotlib plot element which generated this text
"""
--
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