Skip to content

Make some more of figure.py numpydoc #9684

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 7, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 48 additions & 30 deletions lib/matplotlib/figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,15 +259,17 @@ class Figure(Artist):
the callback will be called with ``func(fig)`` where fig is the
:class:`Figure` instance.

*patch*
The figure patch is drawn by a
:class:`matplotlib.patches.Rectangle` instance

*suppressComposite*
For multiple figure images, the figure will make composite
images depending on the renderer option_image_nocomposite
function. If suppressComposite is True|False, this will
override the renderer.
Attributes
----------
patch
The figure patch is drawn by a
:class:`matplotlib.patches.Rectangle` instance

suppressComposite
For multiple figure images, the figure will make composite images
depending on the renderer option_image_nocomposite function.
If *suppressComposite* is ``True`` or ``False``, this will override
the renderer.
"""

def __str__(self):
Expand All @@ -284,33 +286,35 @@ def __init__(self,
tight_layout=None, # default to rc figure.autolayout
):
"""
*figsize*
w,h tuple in inches
Parameters
----------
figsize : 2-tuple of floats
``(width, height)`` tuple in inches

*dpi*
dpi : float
Dots per inch

*facecolor*
facecolor
The figure patch facecolor; defaults to rc ``figure.facecolor``

*edgecolor*
edgecolor
The figure patch edge color; defaults to rc ``figure.edgecolor``

*linewidth*
linewidth : float
The figure patch edge linewidth; the default linewidth of the frame

*frameon*
If *False*, suppress drawing the figure frame
frameon : bool
If ``False``, suppress drawing the figure frame

*subplotpars*
A :class:`SubplotParams` instance, defaults to rc
subplotpars : :class:`SubplotParams`
Subplot parameters, defaults to rc

*tight_layout*
If *False* use *subplotpars*; if *True* adjust subplot
tight_layout : bool
If ``False`` use *subplotpars*; if ``True`` adjust subplot
parameters using :meth:`tight_layout` with default padding.
When providing a dict containing the keys `pad`, `w_pad`, `h_pad`
and `rect`, the default :meth:`tight_layout` paddings will be
overridden.
When providing a dict containing the keys
``pad``, ``w_pad``, ``h_pad``, and ``rect``, the default
:meth:`tight_layout` paddings will be overridden.
Defaults to rc ``figure.autolayout``.
"""
Artist.__init__(self)
Expand Down Expand Up @@ -382,7 +386,7 @@ def _repr_html_(self):
# We can't use "isinstance" here, because then we'd end up importing
# webagg unconditiionally.
if (self.canvas is not None and
'WebAgg' in self.canvas.__class__.__name__):
'WebAgg' in self.canvas.__class__.__name__):
from matplotlib.backends import backend_webagg
return backend_webagg.ipython_inline_display(self)

Expand All @@ -395,8 +399,15 @@ def show(self, warn=True):
:class:`~matplotlib.backend_bases.FigureManagerBase`, and
will raise an AttributeError.

For non-GUI backends, this does nothing, in which case
a warning will be issued if *warn* is True (default).
Parameters
----------
warm : bool
If ``True``, issue warning when called on a non-GUI backend

Notes
-----
For non-GUI backends, this does nothing, in which case a warning will
be issued if *warn* is ``True`` (default).
"""
try:
manager = getattr(self.canvas, 'manager')
Expand Down Expand Up @@ -428,7 +439,12 @@ def _get_dpi(self):

def _set_dpi(self, dpi, forward=True):
"""
The forward kwarg is passed on to set_size_inches
Parameters
----------
dpi : float

forward : bool
Passed on to `~.Figure.set_size_inches`
"""
self._dpi = dpi
self.dpi_scale_trans.clear().scale(dpi, dpi)
Expand All @@ -440,7 +456,7 @@ def _set_dpi(self, dpi, forward=True):

def get_tight_layout(self):
"""
Return the Boolean flag, True to use :meth:`tight_layout` when drawing.
Return whether the figure uses :meth:`tight_layout` when drawing.
"""
return self._tight

Expand Down Expand Up @@ -531,7 +547,9 @@ def contains(self, mouseevent):
return inside, {}

def get_window_extent(self, *args, **kwargs):
'get the figure bounding box in display space; kwargs are void'
''''
Return figure bounding box in display space; arguments are ignored.
'''
return self.bbox

def suptitle(self, t, **kwargs):
Expand Down