From 2240dccb667c8c9c622a6aef8e85e007118f315f Mon Sep 17 00:00:00 2001 From: Olga Botvinnik Date: Sat, 4 Jan 2014 12:58:30 -0800 Subject: [PATCH 1/3] Added rcParams for removing specific spines --- lib/matplotlib/rcsetup.py | 6 ++++++ lib/matplotlib/spines.py | 3 +++ 2 files changed, 9 insertions(+) diff --git a/lib/matplotlib/rcsetup.py b/lib/matplotlib/rcsetup.py index 29bad8374126..06465f71e7e2 100644 --- a/lib/matplotlib/rcsetup.py +++ b/lib/matplotlib/rcsetup.py @@ -574,6 +574,12 @@ def __call__(self, s): 'axes.facecolor': ['w', validate_color], # background color; white 'axes.edgecolor': ['k', validate_color], # edge color; black 'axes.linewidth': [1.0, validate_float], # edge linewidth + + 'axes.spines.left': [True, validate_bool], # Set visibility of axes + 'axes.spines.right': [True, validate_bool], # 'spines', the lines + 'axes.spines.bottom': [True, validate_bool], # around the chart + 'axes.spines.top': [True, validate_bool], # denoting data boundary + 'axes.titlesize': ['large', validate_fontsize], # fontsize of the # axes title 'axes.titleweight': ['normal', six.text_type], # font weight of axes title diff --git a/lib/matplotlib/spines.py b/lib/matplotlib/spines.py index b71bdb244c97..eb4ba6a7dc3f 100644 --- a/lib/matplotlib/spines.py +++ b/lib/matplotlib/spines.py @@ -458,6 +458,9 @@ def linear_spine(cls, axes, spine_type, **kwargs): else: raise ValueError('unable to make path for spine "%s"' % spine_type) result = cls(axes, spine_type, path, **kwargs) + if not rcParams['axes.spines.{}'.format(spine_type)]: + result.set_visible(False) + return result @classmethod From 480173817cf9cfa6acf4b4278ec675aa99f86ab7 Mon Sep 17 00:00:00 2001 From: Olga Botvinnik Date: Sat, 4 Jan 2014 13:58:12 -0800 Subject: [PATCH 2/3] Added xtick.position and ytick.position to rcsetup.py --- lib/matplotlib/rcsetup.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/matplotlib/rcsetup.py b/lib/matplotlib/rcsetup.py index 06465f71e7e2..feec7fda6cad 100644 --- a/lib/matplotlib/rcsetup.py +++ b/lib/matplotlib/rcsetup.py @@ -429,6 +429,13 @@ def validate_bbox(s): return None raise ValueError("bbox should be 'tight' or 'standard'") +validate_xtick_position = ValidateInStrings('xtick.position', + ['both', 'bottom', 'top']) + +validate_ytick_position = ValidateInStrings('ytick.position', + ['both', 'left', 'right']) + + def validate_sketch(s): if s == 'None' or s is None: return None @@ -665,6 +672,7 @@ def __call__(self, s): # fontsize of the xtick labels 'xtick.labelsize': ['medium', validate_fontsize], 'xtick.direction': ['in', six.text_type], # direction of xticks + 'xtick.position': ['both', validate_xtick_position], 'ytick.major.size': [4, validate_float], # major ytick size in points 'ytick.minor.size': [2, validate_float], # minor ytick size in points @@ -676,6 +684,7 @@ def __call__(self, s): # fontsize of the ytick labels 'ytick.labelsize': ['medium', validate_fontsize], 'ytick.direction': ['in', six.text_type], # direction of yticks + 'ytick.position': ['both', validate_ytick_position], 'grid.color': ['k', validate_color], # grid color 'grid.linestyle': [':', six.text_type], # dotted From 950526a8e9a70d3fea86d39f3447d76fc78186db Mon Sep 17 00:00:00 2001 From: Olga Botvinnik Date: Sat, 4 Jan 2014 15:00:14 -0800 Subject: [PATCH 3/3] trying to fix Travis CI failure on 2.6 --- lib/matplotlib/rcsetup.py | 4 ++-- lib/matplotlib/spines.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/rcsetup.py b/lib/matplotlib/rcsetup.py index feec7fda6cad..5f9fb2a0f0ea 100644 --- a/lib/matplotlib/rcsetup.py +++ b/lib/matplotlib/rcsetup.py @@ -430,10 +430,10 @@ def validate_bbox(s): raise ValueError("bbox should be 'tight' or 'standard'") validate_xtick_position = ValidateInStrings('xtick.position', - ['both', 'bottom', 'top']) + ['both', 'bottom', 'top', 'none']) validate_ytick_position = ValidateInStrings('ytick.position', - ['both', 'left', 'right']) + ['both', 'left', 'right', 'none']) def validate_sketch(s): diff --git a/lib/matplotlib/spines.py b/lib/matplotlib/spines.py index eb4ba6a7dc3f..f78d148f7168 100644 --- a/lib/matplotlib/spines.py +++ b/lib/matplotlib/spines.py @@ -458,7 +458,7 @@ def linear_spine(cls, axes, spine_type, **kwargs): else: raise ValueError('unable to make path for spine "%s"' % spine_type) result = cls(axes, spine_type, path, **kwargs) - if not rcParams['axes.spines.{}'.format(spine_type)]: + if not rcParams['axes.spines.{0}'.format(spine_type)]: result.set_visible(False) return result