Skip to content

Commit 53db7f1

Browse files
committed
DOC: remove some usages of None as explicit defaults
In docs, we rather specify "optional" instead of "default: None" when None is only used as a sentinel for "not given". We also specify prefer concrete types or rc references over None usage if possible.
1 parent 0a44bcb commit 53db7f1

File tree

3 files changed

+19
-27
lines changed

3 files changed

+19
-27
lines changed

lib/mpl_toolkits/axes_grid1/axes_grid.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ def __init__(self, fig,
8484
``121``), or as a `~.SubplotSpec`.
8585
nrows_ncols : (int, int)
8686
Number of rows and columns in the grid.
87-
n_axes : int or None, default: None
88-
If not None, only the first *n_axes* axes in the grid are created.
87+
n_axes : int, optional
88+
If given, only the first *n_axes* axes in the grid are created.
8989
direction : {"row", "column"}, default: "row"
9090
Whether axes are created in row-major ("row by row") or
9191
column-major order ("column by column"). This also affects the
@@ -322,8 +322,8 @@ def __init__(self, fig,
322322
as a three-digit subplot position code (e.g., "121").
323323
nrows_ncols : (int, int)
324324
Number of rows and columns in the grid.
325-
n_axes : int or None, default: None
326-
If not None, only the first *n_axes* axes in the grid are created.
325+
n_axes : int, optional
326+
If given, only the first *n_axes* axes in the grid are created.
327327
direction : {"row", "column"}, default: "row"
328328
Whether axes are created in row-major ("row by row") or
329329
column-major order ("column by column"). This also affects the
@@ -364,7 +364,7 @@ def __init__(self, fig,
364364
cbar_set_cax : bool, default: True
365365
If True, each axes in the grid has a *cax* attribute that is bound
366366
to associated *cbar_axes*.
367-
axes_class : subclass of `matplotlib.axes.Axes`, default: None
367+
axes_class : subclass of `matplotlib.axes.Axes`, default: `.mpl_axes.Axes`
368368
"""
369369
_api.check_in_list(["each", "single", "edge", None],
370370
cbar_mode=cbar_mode)

lib/mpl_toolkits/mplot3d/art3d.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -737,9 +737,8 @@ def set_depthshade(
737737
depthshade : bool
738738
Whether to shade the patches in order to give the appearance of
739739
depth.
740-
depthshade_minalpha : float, default: None
740+
depthshade_minalpha : float, default: :rc:`axes3d.depthshade_minalpha`
741741
Sets the minimum alpha value used by depth-shading.
742-
If None, use the value from rcParams['axes3d.depthshade_minalpha'].
743742
744743
.. versionadded:: 3.11
745744
"""
@@ -1112,17 +1111,15 @@ def patch_collection_2d_to_3d(
11121111
zdir : {'x', 'y', 'z'}
11131112
The axis in which to place the patches. Default: "z".
11141113
See `.get_dir_vector` for a description of the values.
1115-
depthshade : bool, default: None
1114+
depthshade : bool, default: :rc:`axes3d.depthshade`
11161115
Whether to shade the patches to give a sense of depth.
1117-
If None, use the value from rcParams['axes3d.depthshade'].
11181116
axlim_clip : bool, default: False
11191117
Whether to hide patches with a vertex outside the axes view limits.
11201118
11211119
.. versionadded:: 3.10
11221120
1123-
depthshade_minalpha : float, default: None
1121+
depthshade_minalpha : float, default: :rc:`axes3d.depthshade_minalpha`
11241122
Sets the minimum alpha value used by depth-shading.
1125-
If None, use the value from rcParams['axes3d.depthshade_minalpha'].
11261123
11271124
.. versionadded:: 3.11
11281125
"""

lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class Axes3D(Axes):
5858
Axes._shared_axes["view"] = cbook.Grouper()
5959

6060
def __init__(
61-
self, fig, rect=None, *args,
61+
self, fig, rect=(0, 0, 1, 1), *args,
6262
elev=30, azim=-60, roll=0, shareview=None, sharez=None,
6363
proj_type='persp', focal_length=None,
6464
box_aspect=None,
@@ -70,7 +70,7 @@ def __init__(
7070
----------
7171
fig : Figure
7272
The parent figure.
73-
rect : tuple (left, bottom, width, height), default: None.
73+
rect : tuple (left, bottom, width, height), default: (0, 0, 1, 1)
7474
The ``(left, bottom, width, height)`` Axes position.
7575
elev : float, default: 30
7676
The elevation angle in degrees rotates the camera above and below
@@ -119,10 +119,6 @@ def __init__(
119119
120120
%(Axes3D:kwdoc)s
121121
"""
122-
123-
if rect is None:
124-
rect = [0.0, 0.0, 1.0, 1.0]
125-
126122
self.initial_azim = azim
127123
self.initial_elev = elev
128124
self.initial_roll = roll
@@ -2049,9 +2045,10 @@ def fill_between(self, x1, y1, z1, x2, y2, z2, *,
20492045
- 'auto': If the points all lie on the same 3D plane, 'polygon' is
20502046
used. Otherwise, 'quad' is used.
20512047
2052-
facecolors : list of :mpltype:`color`, default: None
2048+
facecolors : :mpltype:`color` or list of :mpltype:`color`, optional
20532049
Colors of each individual patch, or a single color to be used for
2054-
all patches.
2050+
all patches. If not given, the next color from the patch color
2051+
cycle is used.
20552052
20562053
shade : bool, default: None
20572054
Whether to shade the facecolors. If *None*, then defaults to *True*
@@ -2943,15 +2940,13 @@ def scatter(self, xs, ys, zs=0, zdir='z', s=20, c=None, depthshade=None,
29432940
- A 2D array in which the rows are RGB or RGBA.
29442941
29452942
For more details see the *c* argument of `~.axes.Axes.scatter`.
2946-
depthshade : bool, default: None
2943+
depthshade : bool, default: :rc:`axes3d.depthshade`
29472944
Whether to shade the scatter markers to give the appearance of
29482945
depth. Each call to ``scatter()`` will perform its depthshading
29492946
independently.
2950-
If None, use the value from rcParams['axes3d.depthshade'].
29512947
2952-
depthshade_minalpha : float, default: None
2948+
depthshade_minalpha : float, default: :rc:`axes3d.depthshade_minalpha`
29532949
The lowest alpha value applied by depth-shading.
2954-
If None, use the value from rcParams['axes3d.depthshade_minalpha'].
29552950
29562951
.. versionadded:: 3.11
29572952
@@ -3627,12 +3622,12 @@ def errorbar(self, x, y, z, zerr=None, yerr=None, xerr=None, fmt='',
36273622
Use 'none' (case-insensitive) to plot errorbars without any data
36283623
markers.
36293624
3630-
ecolor : :mpltype:`color`, default: None
3631-
The color of the errorbar lines. If None, use the color of the
3625+
ecolor : :mpltype:`color`, optional
3626+
The color of the errorbar lines. If not given, use the color of the
36323627
line connecting the markers.
36333628
3634-
elinewidth : float, default: None
3635-
The linewidth of the errorbar lines. If None, the linewidth of
3629+
elinewidth : float, optional
3630+
The linewidth of the errorbar lines. If not given, the linewidth of
36363631
the current style is used.
36373632
36383633
capsize : float, default: :rc:`errorbar.capsize`

0 commit comments

Comments
 (0)