[Python-modules-commits] [python-mplexporter] 50/135: pass grid styles

Wolfgang Borgert debacle at moszumanska.debian.org
Tue Sep 23 21:19:03 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 6388e5363d1586b1bd3df7424d246ff96c238c79
Author: Jake Vanderplas <vanderplas at astro.washington.edu>
Date:   Tue Feb 25 14:14:11 2014 -0800

    pass grid styles
---
 mplexporter/exporter.py |  4 ++++
 mplexporter/utils.py    | 10 ++++++++++
 2 files changed, 14 insertions(+)

diff --git a/mplexporter/exporter.py b/mplexporter/exporter.py
index 569e9ec..cfb4ab9 100644
--- a/mplexporter/exporter.py
+++ b/mplexporter/exporter.py
@@ -109,9 +109,13 @@ class Exporter(object):
                       'xlabel': ax.get_xlabel(),
                       'ylabel': ax.get_ylabel(),
                       'title': ax.get_title(),
+                      'axesbg': utils.color_to_hex(ax.patch.get_facecolor()),
+                      'axesbgalpha': ax.patch.get_alpha(),
                       'bounds': ax.get_position().bounds,
                       'xgrid': bool(ax.xaxis._gridOnMajor
                                     and ax.xaxis.get_gridlines()),
+                      'xgridstyle': utils.get_grid_style(ax, 'x'),
+                      'ygridstyle': utils.get_grid_style(ax, 'y'),
                       'ygrid': bool(ax.yaxis._gridOnMajor
                                     and ax.yaxis.get_gridlines()),
                       'dynamic': ax.get_navigate(),
diff --git a/mplexporter/utils.py b/mplexporter/utils.py
index cfbac22..38e988a 100644
--- a/mplexporter/utils.py
+++ b/mplexporter/utils.py
@@ -219,6 +219,16 @@ def get_axis_properties(axis):
     return props
 
 
+def get_grid_style(ax, grid_type='x'):
+    gridlines = getattr(ax, grid_type + 'axis').get_gridlines()
+    color = color_to_hex(gridlines[0].get_color())
+    alpha = gridlines[0].get_alpha()
+    dasharray = get_dasharray(gridlines[0])
+    return dict(color=color,
+                dasharray=dasharray,
+                alpha=alpha)
+
+
 def image_to_base64(image):
     """
     Convert a matplotlib image to a base64 png representation

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