Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2648b55

Browse files
committed
Cleanup docstrings in backend_bases.py
1 parent a0eb4c1 commit 2648b55

File tree

1 file changed

+35
-34
lines changed

1 file changed

+35
-34
lines changed

lib/matplotlib/backend_bases.py

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def register_backend(format, backend, description=None):
9292
File extension
9393
backend : module string or canvas class
9494
Backend for handling file output
95-
description : str, optional, default: ""
95+
description : str, default: ""
9696
Description of the file type.
9797
"""
9898
if description is None:
@@ -450,14 +450,14 @@ def draw_image(self, gc, x, y, im, transform=None):
450450
Parameters
451451
----------
452452
gc : `GraphicsContextBase`
453-
a graphics context with clipping information.
453+
A graphics context with clipping information.
454454
455455
x : scalar
456-
the distance in physical units (i.e., dots or pixels) from the left
456+
The distance in physical units (i.e., dots or pixels) from the left
457457
hand side of the canvas.
458458
459459
y : scalar
460-
the distance in physical units (i.e., dots or pixels) from the
460+
The distance in physical units (i.e., dots or pixels) from the
461461
bottom side of the canvas.
462462
463463
im : array-like, shape=(N, M, 4), dtype=np.uint8
@@ -506,22 +506,22 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
506506
----------
507507
gc : `GraphicsContextBase`
508508
The graphics context.
509-
x : scalar
509+
x : float
510510
The x location of the text in display coords.
511-
y : scalar
511+
y : float
512512
The y location of the text baseline in display coords.
513513
s : str
514514
The text string.
515515
prop : `matplotlib.font_manager.FontProperties`
516516
The font properties.
517-
angle : scalar
518-
The rotation angle in degrees.
517+
angle : float
518+
The rotation angle in degrees anti-clockwise.
519519
mtext : `matplotlib.text.Text`
520520
The original text object to be rendered.
521521
522522
Notes
523523
-----
524-
**backend implementers note**
524+
**Note for backend implementers:**
525525
526526
When you are trying to determine if you have gotten your bounding box
527527
right (which is what enables the text layout/alignment to work
@@ -653,11 +653,11 @@ def points_to_pixels(self, points):
653653
doesn't have a dpi, e.g., postscript or svg). Some imaging
654654
systems assume some value for pixels per inch::
655655
656-
points to pixels = points * pixels_per_inch/72.0 * dpi/72.0
656+
points to pixels = points * pixels_per_inch/72 * dpi/72
657657
658658
Parameters
659659
----------
660-
points : scalar or array-like
660+
points : float or array-like
661661
a float or a numpy array of float
662662
663663
Returns
@@ -1007,11 +1007,10 @@ def set_sketch_params(self, scale=None, length=None, randomness=None):
10071007
The amplitude of the wiggle perpendicular to the source line, in
10081008
pixels. If scale is `None`, or not provided, no sketch filter will
10091009
be provided.
1010-
length : float, optional
1011-
The length of the wiggle along the line, in pixels (default 128).
1012-
randomness : float, optional
1013-
The scale factor by which the length is shrunken or expanded
1014-
(default 16).
1010+
length : float, default: 128
1011+
The length of the wiggle along the line, in pixels.
1012+
randomness : float, default: 16
1013+
The scale factor by which the length is shrunken or expanded.
10151014
"""
10161015
self._sketch = (
10171016
None if scale is None
@@ -1238,9 +1237,9 @@ class ResizeEvent(Event):
12381237
12391238
Attributes
12401239
----------
1241-
width : scalar
1240+
width : int
12421241
Width of the canvas in pixels.
1243-
height : scalar
1242+
height : int
12441243
Height of the canvas in pixels.
12451244
"""
12461245
def __init__(self, name, canvas):
@@ -1264,9 +1263,9 @@ class LocationEvent(Event):
12641263
12651264
Attributes
12661265
----------
1267-
x : scalar
1266+
x : int
12681267
x position - pixels from left of canvas.
1269-
y : scalar
1268+
y : int
12701269
y position - pixels from bottom of canvas.
12711270
inaxes : `~.axes.Axes` or None
12721271
The `~.axes.Axes` instance over which the mouse is, if any.
@@ -1374,7 +1373,7 @@ class MouseEvent(LocationEvent):
13741373
The key pressed when the mouse event triggered, e.g. 'shift'.
13751374
See `KeyEvent`.
13761375
1377-
step : scalar
1376+
step : int
13781377
The number of scroll steps (positive for 'up', negative for 'down').
13791378
This applies only to 'scroll_event' and defaults to 0 otherwise.
13801379
@@ -1977,29 +1976,31 @@ def print_figure(self, filename, dpi=None, facecolor=None, edgecolor=None,
19771976
filename
19781977
can also be a file object on image backends
19791978
1980-
orientation : {'landscape', 'portrait'}, optional
1979+
orientation : {'landscape', 'portrait'}, default: 'portrait'
19811980
only currently applies to PostScript printing.
19821981
19831982
dpi : float, default: :rc:`savefig.dpi`
19841983
The dots per inch to save the figure in.
19851984
1986-
facecolor : color or None, optional
1987-
the facecolor of the figure; if None, defaults to savefig.facecolor
1985+
facecolor : color, default: :rc:`savefig.facecolor`
1986+
The facecolor of the figure.
19881987
1989-
edgecolor : color or None, optional
1990-
the edgecolor of the figure; if None, defaults to savefig.edgecolor
1988+
edgecolor : color, default: :rc:`savefig.edgecolor`
1989+
The edgecolor of the figure.
19911990
19921991
format : str, optional
1993-
when set, forcibly set the file format to save to
1992+
Force a specific file format. If not given, the format is inferred
1993+
from the *filename* extension, and if that fails from
1994+
:rc:`savefig.format`.
19941995
1995-
bbox_inches : str or `~matplotlib.transforms.Bbox`, optional
1996+
bbox_inches : 'tight' or `~matplotlib.transforms.Bbox`, \
1997+
default: :rc:`savefig.bbox`
19961998
Bbox in inches. Only the given portion of the figure is
19971999
saved. If 'tight', try to figure out the tight bbox of
1998-
the figure. If None, use savefig.bbox
2000+
the figure.
19992001
2000-
pad_inches : scalar, optional
2001-
Amount of padding around the figure when bbox_inches is
2002-
'tight'. If None, use savefig.pad_inches
2002+
pad_inches : float, default: :rc:`savefig.pad_inches`
2003+
Amount of padding around the figure when *bbox_inches* is 'tight'.
20032004
20042005
bbox_extra_artists : list of `~matplotlib.artist.Artist`, optional
20052006
A list of extra artists that will be considered when the
@@ -3401,9 +3402,9 @@ def mainloop(self):
34013402

34023403
class ShowBase(_Backend):
34033404
"""
3404-
Simple base class to generate a show() callable in backends.
3405+
Simple base class to generate a ``show()`` function in backends.
34053406
3406-
Subclass must override mainloop() method.
3407+
Subclass must override ``mainloop()`` method.
34073408
"""
34083409

34093410
def __call__(self, block=None):

0 commit comments

Comments
 (0)