diff --git a/lib/matplotlib/rcsetup.py b/lib/matplotlib/rcsetup.py index 29bad8374126..5f9fb2a0f0ea 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', 'none']) + +validate_ytick_position = ValidateInStrings('ytick.position', + ['both', 'left', 'right', 'none']) + + def validate_sketch(s): if s == 'None' or s is None: return None @@ -574,6 +581,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 @@ -659,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 @@ -670,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 diff --git a/lib/matplotlib/spines.py b/lib/matplotlib/spines.py index b71bdb244c97..f78d148f7168 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.{0}'.format(spine_type)]: + result.set_visible(False) + return result @classmethod