[Python-modules-commits] [python-mplexporter] 78/135: Added 'fontsize' to axis properties.

Wolfgang Borgert debacle at moszumanska.debian.org
Tue Sep 23 21:19:06 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 a42c6324dbb33d753078847542a0c665ef07af21
Author: theengineear <andseier at gmail.com>
Date:   Mon Mar 3 22:17:30 2014 -0800

    Added 'fontsize' to axis properties.
    
    Added a few lines to grab the tick font size. You might want to change
    the name of this dictionary key to be something else. I left it as
    'fontsize' because that's what mpl calls it! The real confusion is that
    it's in the axis dict, but should not be confused with the axis label
    size. You might consider changing it to 'ticksize' or something later
    on?
    
    The lines simply make a list of the font sizes for the ticks and checks
    to see that they all match. I'm sure it's not 100% bug-free, i.e., if
    the font size entires aren't numbers (None, '', 'none', etc.). However,
    if they're not all the same it returns a None value.
    
    As a side note, I really like being able to assume an exporter value is
    either a valid entry or None. I think this format should be continued.
---
 mplexporter/utils.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/mplexporter/utils.py b/mplexporter/utils.py
index 2d8189d..a9b8038 100644
--- a/mplexporter/utils.py
+++ b/mplexporter/utils.py
@@ -218,6 +218,13 @@ def get_axis_properties(axis):
     # Get axis scale
     props['scale'] = axis.get_scale()
 
+    # Get major tick label size (assumes that's all we really care about!)
+    sizes = [tick.get_fontsize() for tick in axis.get_ticklabels()]
+    if sizes[1:] == sizes[:-1]:
+        props['fontsize'] = sizes[0]
+    else:
+        props['fontsize'] = None
+
     # Get associated grid
     props['grid'] = get_grid_style(axis)
 

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