Skip to content

Commit 44e3790

Browse files
committed
Merge pull request #1908 from tacaswell/margins_rcParam
added rcParam for x and y margin
2 parents c1d18f1 + fea9f9b commit 44e3790

File tree

5 files changed

+21
-4
lines changed

5 files changed

+21
-4
lines changed

CHANGELOG

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
2013-04-15 Added 'axes.xmargin' and 'axes.ymargin' to rpParams to set default
2+
margins on auto-scaleing. - TAC
3+
14
2013-03-19 Added support for passing `linestyle` kwarg to `step` so all `plot`
25
kwargs are passed to the underlying `plot` call. -TAC
36

doc/users/whats_new.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ revision, see the :ref:`github-stats`.
2121

2222
new in matplotlib-1.3
2323
=====================
24+
``axes.xmargin`` and ``axes.ymargin`` added to rcParams
25+
-------------------------------------------------------
26+
``rcParam`` values (``axes.xmargin`` and ``axes.ymargin``) were added
27+
to configure the default margins used. Previously they were
28+
hard-coded to default to 0, default value of both rcParam values is 0.
29+
2430

2531
New eventplot plot type
2632
-------------------------------------

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)