Skip to content

Commit 61f141a

Browse files
committed
added rcParam for x and y margin
Addresses issue matplotlib#1766
1 parent 9e477b3 commit 61f141a

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

lib/matplotlib/axes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -901,8 +901,8 @@ def cla(self):
901901

902902
self._autoscaleXon = True
903903
self._autoscaleYon = True
904-
self._xmargin = 0
905-
self._ymargin = 0
904+
self._xmargin = rcParams['axes.xmargin']
905+
self._ymargin = rcParams['axes.ymargin']
906906
self._tight = False
907907
self._update_transScale() # needed?
908908

@@ -9076,7 +9076,7 @@ def matshow(self, Z, **kwargs):
90769076
return im
90779077

90789078
def get_default_bbox_extra_artists(self):
9079-
return [artist for artist in self.get_children()
9079+
return [artist for artist in self.get_children()
90809080
if artist.get_visible()]
90819081

90829082
def get_tightbbox(self, renderer, call_axes_locator=True):

lib/matplotlib/rcsetup.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,6 +579,12 @@ def __call__(self, s):
579579
'axes.color_cycle': [['b', 'g', 'r', 'c', 'm', 'y', 'k'],
580580
validate_colorlist], # cycle of plot
581581
# line colors
582+
'axes.xmargin': [0, ValidateInterval(0, 1,
583+
closedmin=True,
584+
closedmax=True)], # margin added to xaxis
585+
'axes.ymargin': [0, ValidateInterval(0, 1,
586+
closedmin=True,
587+
closedmax=True)],# margin added to yaxis
582588

583589
'polaraxes.grid': [True, validate_bool], # display polar grid or
584590
# not

matplotlibrc.template

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,8 @@ text.hinting_factor : 8 # Specifies the amount of softness for hinting in the
250250
# as list of string colorspecs:
251251
# single letter, long name, or
252252
# web-style hex
253+
#axes.xmargin : 0 # x margin. See `axes.Axes.margins`
254+
#axes.ymargin : 0 # y margin See `axes.Axes.margins`
253255

254256
#polaraxes.grid : True # display grid on polar axes
255257
#axes3d.grid : True # display grid on 3d axes
@@ -451,7 +453,7 @@ text.hinting_factor : 8 # Specifies the amount of softness for hinting in the
451453
#animation.avconv_path: 'avconv' # Path to avconv binary. Without full path
452454
# $PATH is searched
453455
#animation.avconv_args: '' # Additional arguments to pass to avconv
454-
#animation.mencoder_path: 'mencoder'
456+
#animation.mencoder_path: 'mencoder'
455457
# Path to mencoder binary. Without full path
456458
# $PATH is searched
457459
#animation.mencoder_args: '' # Additional arguments to pass to mencoder

0 commit comments

Comments
 (0)