@@ -2227,41 +2227,58 @@ def margins(self, *margins, x=None, y=None, tight=True):
22272227 """
22282228 Set or retrieve autoscaling margins.
22292229
2230- signatures::
2230+ The padding added to each limit of the axes is the *margin*
2231+ times the data interval. All input parameters must be floats
2232+ within the range [0, 1]. Passing both positional and keyword
2233+ arguments is invalid and will raise a TypeError. If no
2234+ arguments (positional or otherwise) are provided, the current
2235+ margins will remain in place and simply be returned.
22312236
2232- margins()
2233-
2234- returns xmargin, ymargin
2235-
2236- ::
2237-
2238- margins(margin)
2239-
2240- margins(xmargin, ymargin)
2237+ Specifying any margin changes only the autoscaling; for example,
2238+ if *xmargin* is not None, then *xmargin* times the X data
2239+ interval will be added to each end of that interval before
2240+ it is used in autoscaling.
22412241
2242- margins(x=xmargin, y=ymargin)
2242+ Parameters
2243+ ----------
2244+ args : float, optional
2245+ If a single positional argument is provided, it specifies
2246+ both margins of the x-axis and y-axis limits. If two
2247+ positional arguments are provided, they will be interpreted
2248+ as *xmargin*, *ymargin*. If setting the margin on a single
2249+ axis is desired, use the keyword arguments described below.
2250+
2251+ x, y : float, optional
2252+ Specific margin values for the x-axis and y-axis,
2253+ respectively. These cannot be used with positional
2254+ arguments, but can be used individually to alter on e.g.,
2255+ only the y-axis.
2256+
2257+ tight : bool, default is True
2258+ The *tight* parameter is passed to :meth:`autoscale_view`,
2259+ which is executed after a margin is changed; the default
2260+ here is *True*, on the assumption that when margins are
2261+ specified, no additional padding to match tick marks is
2262+ usually desired. Set *tight* to *None* will preserve
2263+ the previous setting.
22432264
2244- margins(..., tight=False)
22452265
2246- All three forms above set the xmargin and ymargin parameters.
2247- All keyword parameters are optional. A single positional argument
2248- specifies both xmargin and ymargin. The padding added to the end of
2249- each interval is *margin* times the data interval. The *margin* must
2250- be a float in the range [0, 1]. Passing both positional and keyword
2251- arguments for xmargin and/or ymargin is invalid.
2266+ Returns
2267+ -------
2268+ xmargin, ymargin : float
22522269
2253- The *tight* parameter is passed to :meth:`autoscale_view`
2254- , which is executed after a margin is changed; the default here is
2255- *True*, on the assumption that when margins are specified, no
2256- additional padding to match tick marks is usually desired. Setting
2257- *tight* to *None* will preserve the previous setting.
2270+ Notes
2271+ -----
2272+ If a previously used Axes method such as :meth:`pcolor` has set
2273+ :attr:`use_sticky_edges` to `True`, only the limits not set by
2274+ the "sticky artists" will be modified. To force all of the
2275+ margins to be set, set :attr:`use_sticky_edges` to `False`
2276+ before calling :meth:`margins`.
22582277
2259- Specifying any margin changes only the autoscaling; for example,
2260- if *xmargin* is not None, then *xmargin* times the X data
2261- interval will be added to each end of that interval before
2262- it is used in autoscaling.
2278+ .. plot:: gallery/subplots_axes_and_figures/axes_margins.py
22632279
22642280 """
2281+
22652282 if margins and x is not None and y is not None :
22662283 raise TypeError ('Cannot pass both positional and keyword '
22672284 'arguments for x and/or y.' )
0 commit comments