8000 Merge pull request #10091 from anntzer/truefalse · matplotlib/matplotlib@3700451 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3700451

Browse files
authored
Merge pull request #10091 from anntzer/truefalse
Replace "True | False" by "bool" in the docs.
2 parents a1e9db1 + 5d6c42a commit 3700451

File tree

14 files changed

+133
-108
lines changed

14 files changed

+133
-108
lines changed

lib/matplotlib/axes/_base.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -445,17 +445,16 @@ def __init__(self, fig, rect,
445445
*anchor* [ 'C', 'SW', 'S', 'SE', 'E', 'NE', 'N',
446446
'NW', 'W' ]
447447
*aspect* [ 'auto' | 'equal' | aspect_ratio ]
448-
*autoscale_on* [ *True* | *False* ] whether or not to
449-
autoscale the *viewlim*
450-
*axisbelow* [ *True* | *False* | 'line'] draw the grids
448+
*autoscale_on* bool; whether to autoscale the *viewlim*
449+
*axisbelow* [ bool | 'line' ] draw the grids
451450
and ticks below or above most other artists,
452451
or below lines but above patches
453452
*cursor_props* a (*float*, *color*) tuple
454453
*figure* a :class:`~matplotlib.figure.Figure`
455454
instance
456-
*frame_on* a boolean - draw the axes frame
455+
*frame_on* bool; whether to draw the axes frame
457456
*label* the axes label
458-
*navigate* [ *True* | *False* ]
457+
*navigate* bool
459458
*navigate_mode* [ 'PAN' | 'ZOOM' | None ] the navigation
460459
toolbar button status
461460
*position* [left, bottom, width, height] in
@@ -465,8 +464,7 @@ def __init__(self, fig, rect,
465464
*sharey* an class:`~matplotlib.axes.Axes` instance
466465
to share the y-axis with
467466
*title* the title string
468-
*visible* [ *True* | *False* ] whether the axes is
469-
visible
467+
*visible* bool, whether the axes is visible
470468
*xlabel* the xlabel
471469
*xlim* (*xmin*, *xmax*) view limits
472470
*xscale* [%(scale)s]
@@ -1289,7 +1287,7 @@ def set_aspect(self, aspect, adjustable=None, anchor=None):
12891287
anchor : None or str or 2-tuple of float, optional
12901288
If not ``None``, this defines where the Axes will be drawn if there
12911289
is extra space due to aspect constraints. The most common way to
1292-
to specify the anchor are abbreviations of carindal directions:
1290+
to specify the anchor are abbreviations of cardinal directions:
12931291
12941292
===== =====================
12951293
value description
@@ -2322,14 +2320,14 @@ def autoscale(self, enable=True, axis='both', tight=None):
23222320
23232321
Parameters
23242322
----------
2325-
enable : [True | False | None], optional
2323+
enable : bool or None, optional
23262324
True (default) turns autoscaling on, False turns it off.
23272325
None leaves the autoscaling state unchanged.
23282326
23292327
axis : ['both' | 'x' | 'y'], optional
23302328
which axis to operate on; default is 'both'
23312329
2332-
tight: [None | True | False], optional
2330+
tight: bool or None, optional
23332331
If True, set view limits to data limits;
23342332
if False, let the locator and margins expand the view limits;
23352333
if None, use tight scaling if the only artist is an image,
@@ -2666,7 +2664,7 @@ def ticklabel_format(self, **kwargs):
26662664
be used for numbers outside the range
26672665
10`m`:sup: to 10`n`:sup:.
26682666
Use (0,0) to include all numbers.
2669-
*useOffset* [True | False | offset]; if True,
2667+
*useOffset* [ bool | offset ]; if True,
26702668
the offset will be calculated as needed;
26712669
if False, no offset will be used; if a
26722670
numeric offset is specified, it will be
@@ -2751,7 +2749,7 @@ def locator_params(self, axis='both', tight=None, **kwargs):
27512749
axis : ['both' | 'x' | 'y'], optional
27522750
The axis on which to operate.
27532751
2754-
tight : [None | True | False], optional
2752+
tight : bool or None, optional
27552753
Parameter passed to :meth:`autoscale_view`.
27562754
Default is None, for no change.
27572755

lib/matplotlib/colorbar.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
be given, indicating the lengths of the minimum and
8989
maximum colorbar extensions respectively as a
9090
fraction of the interior colorbar length.
91-
*extendrect* [ *False* | *True* ]
91+
*extendrect* bool
9292
If *False* the minimum and maximum colorbar extensions
9393
will be triangular (the default). If *True* the
9494
extensions will be rectangular.
@@ -106,8 +106,8 @@
106106
used. An alternative
107107
:class:`~matplotlib.ticker.Formatter` object may be
108108
given instead.
109-
*drawedges* [ False | True ] If true, draw lines at color
110-
boundaries.
109+
*drawedges* bool
110+
Whether to draw lines at color boundaries.
111111
============ ====================================================
112112
113113
The following will probably be useful only in the context of

lib/matplotlib/contour.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1719,7 +1719,7 @@ def _initialize_x_y(self, z):
17191719
Override axis units by specifying an instance of a
17201720
:class:`matplotlib.units.ConversionInterface`.
17211721
1722-
*antialiased*: [ *True* | *False* ]
1722+
*antialiased*: bool
17231723
enable antialiasing, overriding the defaults. For
17241724
filled contours, the default is *True*. For line contours,
17251725
it is taken from rcParams['lines.antialiased'].

lib/matplotlib/figure.py

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -256,23 +256,20 @@ def _update_this(self, s, val):
256256
class Figure(Artist):
257257

258258
"""
259-
The Figure instance supports callbacks through a *callbacks*
260-
attribute which is a :class:`matplotlib.cbook.CallbackRegistry`
261-
instance. The events you can connect to are 'dpi_changed', and
262-
the callback will be called with ``func(fig)`` where fig is the
263-
:class:`Figure` instance.
259+
The Figure instance supports callbacks through a *callbacks* attribute
260+
which is a `~.CallbackRegistry` instance. The events you can connect to
261+
are 'dpi_changed', and the callback will be called with ``func(fig)`` where
262+
fig is the `Figure` instance.
264263
265264
Attributes
266265
----------
267266
patch
268-
The figure patch is drawn by a
269-
:class:`matplotlib.patches.Rectangle` instance
267+
The `~.Rectangle` instance representing the figure patch.
270268
271269
suppressComposite
272270
For multiple figure images, the figure will make composite images
273-
depending on the renderer option_image_nocomposite function.
274-
If *suppressComposite* is ``True`` or ``False``, this will override
275-
the renderer.
271+
depending on the renderer option_image_nocomposite function. If
272+
*suppressComposite* is a boolean, this will override the renderer.
276273
"""
277274

278275
def __str__(self):
@@ -321,10 +318,10 @@ def __init__(self,
321318
322319
tight_layout : bool
323320
If ``False`` use *subplotpars*; if ``True`` adjust subplot
324-
parameters using :meth:`tight_layout` with default padding.
321+
parameters using `~.tight_layout` with default padding.
325322
When providing a dict containing the keys
326323
``pad``, ``w_pad``, ``h_pad``, and ``rect``, the default
327-
:meth:`tight_layout` paddings will be overridden.
324+
`~.tight_layout` paddings will be overridden.
328325
Defaults to rc ``figure.autolayout``.
329326
"""
330327
Artist.__init__(self)
@@ -466,20 +463,26 @@ def _set_dpi(self, dpi, forward=True):
466463

467464
def get_tight_layout(self):
468465
"""
469-
Return whether the figure uses :meth:`tight_layout` when drawing.
466+
Return whether and how `~.tight_layout` is called when drawing.
470467
"""
471468
return self._tight
472469

473470
def set_tight_layout(self, tight):
474471
"""
475-
Set whether :meth:`tight_layout` is used upon drawing.
476-
If None, the rcParams['figure.autolayout'] value will be set.
472+
Set whether and how `~.tight_layout` is called when drawing.
477473
478-
When providing a dict containing the keys `pad`, `w_pad`, `h_pad`
479-
and `rect`, the default :meth:`tight_layout` paddings will be
480-
overridden.
481-
482-
ACCEPTS: [True | False | dict | None ]
474+
Parameters
475+
----------
476+
tight : bool or dict with keys "pad", "w_pad", "h_pad", "rect" or None
477+
If a bool, sets whether to call `~.tight_layout` upon drawing.
478+
If ``None``, use the ``figure.autolayout`` rcparam instead.
479+
If a dict, pass it as kwargs to `~.tight_layout`, overriding the
480+
default paddings.
481+
482+
..
483+
ACCEPTS: [ bool
484+
| dict with keys "pad", "w_pad", "h_pad", "rect"
485+
| None ]
483486
"""
484487
if tight is None:
485488
tight = rcParams['figure.autolayout']

lib/matplotlib/legend.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,49 +1118,48 @@ def set_title(self, title, prop=None):
11181118
self.stale = True
11191119

11201120
def get_title(self):
1121-
'Return `~.text.Text` instance for the legend title.'
1121+
'Return the `~.Text` instance for the legend title.'
11221122
return self._legend_title_box._text
11231123

11241124
def get_window_extent(self, *args, **kwargs):
11251125
'Return extent of the legend.'
11261126
return self.legendPatch.get_window_extent(*args, **kwargs)
11271127

11281128
def get_frame_on(self):
1129-
"""
1130-
Get whether the legend box patch is drawn.
1131-
"""
1129+
"""Get whether the legend box patch is drawn."""
11321130
return self._drawFrame
11331131

11341132
def set_frame_on(self, b):
11351133
"""
1136-
Set whether the legend box patch is drawn
1134+
Set whether the legend box patch is drawn.
11371135
1138-
ACCEPTS: [ *True* | *False* ]
1136+
Parameters
1137+
----------
1138+
b : bool
1139+
..
1140+
ACCEPTS: bool
11391141
"""
11401142
self._drawFrame = b
11411143
self.stale = True
11421144

11431145
def get_bbox_to_anchor(self):
1144-
"""
1145-
Return the bbox that the legend will be anchored.
1146-
"""
1146+
"""Return the bbox that the legend will be anchored to."""
11471147
if self._bbox_to_anchor is None:
11481148
return self.parent.bbox
11491149
else:
11501150
return self._bbox_to_anchor
11511151

11521152
def set_bbox_to_anchor(self, bbox, transform=None):
11531153
"""
1154-
Set the bbox that the legend will be anchored.
1154+
Set the bbox that the legend will be anchored to.
11551155
11561156
*bbox* can be
11571157
11581158
- A `~.BboxBase` instance
11591159
- A tuple of ``(left, bottom, width, height)`` in the given transform
11601160
(normalized axes coordinate if None)
1161-
- A tuple of ``[left, bottom]`` where the width and height will be
1161+
- A tuple of ``(left, bottom)`` where the width and height will be
11621162
assumed to be zero.
1163-
11641163
"""
11651164
if bbox is None:
11661165
self._bbox_to_anchor = None

lib/matplotlib/lines.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -966,9 +966,13 @@ def get_xydata(self):
966966

967967
def set_antialiased(self, b):
968968
"""
969-
True if line should be drawin with antialiased rendering
969+
Set whether to use antialiased rendering.
970970
971-
ACCEPTS: [True | False]
971+
Parameters
972+
----------
973+
b : bool
974+
..
975+
ACCEPTS: bool
972976
"""
973977
if self._antialiased != b:
974978
self.stale = True

lib/matplotlib/patches.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,13 @@ def get_linestyle(self):
254254

255255
def set_antialiased(self, aa):
256256
"""
257-
Set whether to use antialiased rendering
257+
Set whether to use antialiased rendering.
258258
259-
ACCEPTS: [True | False] or None for default
259+
Parameters
260+
----------
261+
b : bool or None
262+
..
263+
ACCEPTS: bool or None
260264
"""
261265
if aa is None:
262266
aa = mpl.rcParams['patch.antialiased']
@@ -413,9 +417,13 @@ def set_ls(self, ls):
413417

414418
def set_fill(self, b):
415419
"""
416-
Set whether to fill the patch
420+
Set whether to fill the patch.
417421
418-
ACCEPTS: [True | False]
422+
Parameters
423+
----------
424+
b : bool
425+
..
426+
ACCEPTS: bool
419427
"""
420428
self._fill = bool(b)
421429
self._set_facecolor(self._original_facecolor)
@@ -1211,7 +1219,7 @@ def __init__(self, x, y, dx, dy, width=0.001, length_includes_head=False,
12111219
*width*: float (default: 0.001)
12121220
width of full arrow tail
12131221
1214-
*length_includes_head*: [True | False] (default: False)
1222+
*length_includes_head*: bool (default: False)
12151223
True if head is to be counted in calculating the length.
12161224
12171225
*head_width*: float or None (default: 3*width)
@@ -1227,7 +1235,7 @@ def __init__(self, x, y, dx, dy, width=0.001, length_includes_head=False,
12271235
fraction that the arrow is swept back (0 overhang means
12281236
triangular shape). Can be negative or greater than one.
12291237
1230-
*head_starts_at_zero*: [True | False] (default: False)
1238+
*head_starts_at_zero*: bool (default: False)
12311239
if True, the head starts being drawn at coordinate 0
12321240
instead of ending at coordinate 0.
12331241

lib/matplotlib/pyplot.py

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -892,21 +892,18 @@ def axes(arg=None, **kwargs):
892892
`.Figure.add_axes` respectively. Some common keyword arguments are
893893
listed below:
894894
895-
========= ============== ==============================================
896-
kwarg Accepts Description
897-
========= ============== ==============================================
898-
facecolor color the axes background color
899-
frameon [True|False] display the frame?
900-
sharex otherax current axes shares xaxis attribute
901-
with otherax
902-
sharey otherax current axes shares yaxis attribute
903-
with otherax
904-
polar [True|False] use a polar axes?
905-
aspect [str | num] ['equal', 'auto'] or a number. If a number
906-
the ratio of y-unit/x-unit in screen-space.
907-
Also see
908-
:meth:`~matplotlib.axes.Axes.set_aspect`.
909-
========= ============== ==============================================
895+
========= =========== =================================================
896+
kwarg Accepts Description
897+
========= =========== =================================================
898+
facecolor color the axes background color
899+
frameon bool whether to display the frame
900+
sharex otherax share x-axis with *otherax*
901+
sharey otherax share y-axis with *otherax*
902+
polar bool whether to use polar axes
903+
aspect [str | num] ['equal', 'auto'] or a number. If a number, the
904+
ratio of y-unit/x-unit in screen-space. See also
905+
`~.Axes.set_aspect`.
906+
========= =========== =================================================
910907
911908
Returns
912909
-------

lib/matplotlib/text.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -567,29 +567,30 @@ def set_clip_on(self, b):
567567
"""
568568
Set whether artist uses clipping.
569569
570-
When False artists will be visible out side of the axes which
571-
can lead to unexpected results.
570+
When False, artists will be visible outside of the axes, which can lead
571+
to unexpected results.
572572
573-
ACCEPTS: [True | False]
573+
Parameters
574+
----------
575+
b : bool
576+
..
577+
ACCEPTS: bool
574578
"""
575579
super(Text, self).set_clip_on(b)
576580
self._update_clip_properties()
577581

578582
def get_wrap(self):
579-
"""
580-
Returns the wrapping state for the text.
581-
"""
583+
"""Returns the wrapping state for the text."""
582584
return self._wrap
583585

584586
def set_wrap(self, wrap):
585587
"""Sets the wrapping state for the text.
586588
587-
..
588-
ACCEPTS: bool
589-
590589
Parameters
591590
----------
592591
wrap : bool
592+
..
593+
ACCEPTS: bool
593594
"""
594595
self._wrap = wrap
595596

lib/matplotlib/tri/tricontour.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ def _contour_args(self, args, kwargs):
255255
256256
tricontourf-only keyword arguments:
257257
258-
*antialiased*: [ *True* | *False* ]
258+
*antialiased*: bool
259259
enable antialiasing
260260
261261
Note: tricontourf fills intervals that are closed at the top; that

0 commit comments

Comments
 (0)
0