Finally made this into a patch to allow the dynamic updating of the
axes.labelpad parameter.
Hope this is in the appropriate format!
Thanks,
-- Peter
On Mon, Oct 28, 2013 at 10:45 AM, Peter St. John <peterc.stj...@gmail.com>
wrote:
> Hi Matplotlib-users,
>
> I found it was useful to be able to change the default 'Axis.labelpad'
> parameter, since this value didn't scale when changing the default figure
> size (in my opinion its easier to prepare figures for publication assuming
> they'll need to fit in a 1-column figure). I don't consider myself
> experienced enough to attempt to contribute a patch, but nevertheless here
> is the hack I used in case anyone has a similar problem:
>
> axis.py, line 652:
> original: self.labelpad = 5
> changed : self.labelpad = rcParams['axes.labelpad']
>
> Then, in rcsetup.py, I added the line (at 578):
> 'axes.labelpad' : [5.0, validate_float],
>
> This lets you put
> axes.labelpad : 3
> for instance, in your matplotlibrc to change the default label padding.
>
> Anyways, not sure if this is the right mailing list for this type of
> thing, but just thought I'd contribute it nevertheless.
>
> Best,
> -- Peter
>
From af5db935d3d5d00a4122bb329f4119ea07cc82ba Mon Sep 17 00:00:00 2001
From: "Peter St. John" <peterc.stj...@gmail.com>
Date: Fri, 30 May 2014 12:33:02 -0700
Subject: [PATCH] BF - added options for axes.labelpad in matplotlibrc
---
lib/matplotlib/axis.py | 2 +-
lib/matplotlib/rcsetup.py | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/matplotlib/axis.py b/lib/matplotlib/axis.py
index 6d31f1b..b7c52a2 100644
--- a/lib/matplotlib/axis.py
+++ b/lib/matplotlib/axis.py
@@ -653,7 +653,7 @@ class Axis(artist.Artist):
self._smart_bounds = False
self.label = self._get_label()
- self.labelpad = 5
+ self.labelpad = rcParams['axes.labelpad']
self.offsetText = self._get_offset_text()
self.majorTicks = []
self.minorTicks = []
diff --git a/lib/matplotlib/rcsetup.py b/lib/matplotlib/rcsetup.py
index bb228d7..e0f9af5 100644
--- a/lib/matplotlib/rcsetup.py
+++ b/lib/matplotlib/rcsetup.py
@@ -585,6 +585,7 @@ defaultParams = {
# axis locator
'axes.labelsize': ['medium', validate_fontsize], # fontsize of the
# x any y labels
+ 'axes.labelpad': [5.0, validate_float], # space between label and axis
'axes.labelweight': ['normal', six.text_type], # fontsize of the x any y labels
'axes.labelcolor': ['k', validate_color], # color of axis label
'axes.formatter.limits': [[-7, 7], validate_nseq_int(2)],
--
1.9.1
------------------------------------------------------------------------------
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel