[Python-modules-commits] [python-mplexporter] 51/135: BUG: fix plot with no gridlines

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 a2b002aff8443df83849ead2ff34ba2b4299ccf3
Author: Jake Vanderplas <vanderplas at astro.washington.edu>
Date:   Tue Feb 25 14:19:49 2014 -0800

    BUG: fix plot with no gridlines
---
 mplexporter/utils.py | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/mplexporter/utils.py b/mplexporter/utils.py
index 38e988a..8fda335 100644
--- a/mplexporter/utils.py
+++ b/mplexporter/utils.py
@@ -221,12 +221,15 @@ def get_axis_properties(axis):
 
 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)
+    if len(gridlines) > 0:
+        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)
+    else:
+        return {}
 
 
 def image_to_base64(image):

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