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

Skip to content

Commit e3177f8

Browse files
authored
Merge pull request #16169 from anntzer/spacecomma
STY: Add missing spaces after commas.
2 parents e05681f + 8b4ec3b commit e3177f8

File tree

22 files changed

+82
-93
lines changed

22 files changed

+82
-93
lines changed

examples/color/custom_cmap.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@
147147
# in the middle of the range.
148148
cdict4 = {**cdict3,
149149
'alpha': ((0.0, 1.0, 1.0),
150-
# (0.25,1.0, 1.0),
150+
# (0.25, 1.0, 1.0),
151151
(0.5, 0.3, 0.3),
152-
# (0.75,1.0, 1.0),
152+
# (0.75, 1.0, 1.0),
153153
(1.0, 1.0, 1.0)),
154154
}
155155

examples/images_contours_and_fields/irregulardatagrid.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
# Note that scipy.interpolate provides means to interpolate data on a grid
5454
# as well. The following would be an alternative to the four lines above:
5555
#from scipy.interpolate import griddata
56-
#zi = griddata((x, y), z, (xi[None,:], yi[:,None]), method='linear')
56+
#zi = griddata((x, y), z, (xi[None, :], yi[:, None]), method='linear')
5757

5858
ax1.contour(xi, yi, zi, levels=14, linewidths=0.5, colors='k')
5959
cntr1 = ax1.contourf(xi, yi, zi, levels=14, cmap="RdBu_r")

examples/pyplots/whats_new_99_spines.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import numpy as np
99

1010

11-
def adjust_spines(ax,spines):
11+
def adjust_spines(ax, spines):
1212
for loc, spine in ax.spines.items():
1313
if loc in spines:
1414
spine.set_position(('outward', 10)) # outward by 10 points
@@ -30,24 +30,24 @@ def adjust_spines(ax,spines):
3030

3131
fig = plt.figure()
3232

33-
x = np.linspace(0,2*np.pi,100)
33+
x = np.linspace(0, 2*np.pi, 100)
3434
y = 2*np.sin(x)
3535

36-
ax = fig.add_subplot(2,2,1)
37-
ax.plot(x,y)
38-
adjust_spines(ax,['left'])
36+
ax = fig.add_subplot(2, 2, 1)
37+
ax.plot(x, y)
38+
adjust_spines(ax, ['left'])
3939

40-
ax = fig.add_subplot(2,2,2)
41-
ax.plot(x,y)
42-
adjust_spines(ax,[])
40+
ax = fig.add_subplot(2, 2, 2)
41+
ax.plot(x, y)
42+
adjust_spines(ax, [])
4343

44-
ax = fig.add_subplot(2,2,3)
45-
ax.plot(x,y)
46-
adjust_spines(ax,['left','bottom'])
44+
ax = fig.add_subplot(2, 2, 3)
45+
ax.plot(x, y)
46+
adjust_spines(ax, ['left', 'bottom'])
4747

48-
ax = fig.add_subplot(2,2,4)
49-
ax.plot(x,y)
50-
adjust_spines(ax,['bottom'])
48+
ax = fig.add_subplot(2, 2, 4)
49+
ax.plot(x, y)
50+
adjust_spines(ax, ['bottom'])
5151

5252
plt.show()
5353

examples/text_labels_and_annotations/accented_text.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@
55
66
Matplotlib supports accented characters via TeX mathtext or unicode.
77
8-
Using mathtext, the following accents are provided: \hat, \breve, \grave, \bar,
9-
\acute, \tilde, \vec, \dot, \ddot. All of them have the same syntax,
10-
e.g., to make an overbar you do \bar{o} or to make an o umlaut you do
11-
\ddot{o}. The shortcuts are also provided, e.g.,: \"o \'e \`e \~n \.x
12-
\^y
13-
8+
Using mathtext, the following accents are provided: \\hat, \\breve, \\grave,
9+
\\bar, \\acute, \\tilde, \\vec, \\dot, \\ddot. All of them have the same
10+
syntax, e.g. \\bar{o} yields "o overbar", \\ddot{o} yields "o umlaut".
11+
Shortcuts such as \\"o \\'e \\`e \\~n \\.x \\^y are also supported.
1412
"""
13+
1514
import matplotlib.pyplot as plt
1615

1716
# Mathtext demo

examples/text_labels_and_annotations/font_family_rc_sgskip.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
style (e.g., 'serif', 'sans-serif', or 'monospace').
88
99
In the example below, we only allow one font family (Tahoma) for the
10-
sans-serif font style. You the default family with the font.family rc
11-
param, e.g.,::
10+
sans-serif font style. The default family is set with the font.family rcparam,
11+
e.g. ::
1212
1313
rcParams['font.family'] = 'sans-serif'
1414
@@ -17,10 +17,8 @@
1717
1818
rcParams['font.sans-serif'] = ['Tahoma', 'DejaVu Sans',
1919
'Lucida Grande', 'Verdana']
20-
2120
"""
2221

23-
2422
from matplotlib import rcParams
2523
rcParams['font.family'] = 'sans-serif'
2624
rcParams['font.sans-serif'] = ['Tahoma']

examples/user_interfaces/svg_tooltip_sgskip.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,13 @@
9090
function ShowTooltip(obj) {
9191
var cur = obj.id.split("_")[1];
9292
var tip = svgDocument.getElementById('mytooltip_' + cur);
93-
tip.setAttribute('visibility',"visible")
93+
tip.setAttribute('visibility', "visible")
9494
}
9595
9696
function HideTooltip(obj) {
9797
var cur = obj.id.split("_")[1];
9898
var tip = svgDocument.getElementById('mytooltip_' + cur);
99-
tip.setAttribute('visibility',"hidden")
99+
tip.setAttribute('visibility', "hidden")
100100
}
101101
102102
]]>

lib/matplotlib/_constrained_layout.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,8 +402,8 @@ def _align_spines(fig, gs):
402402
# different sizes if they occupy different amounts
403403
# of the gridspec: i.e.
404404
# gs = gridspec.GridSpec(3, 1)
405-
# ax1 = gs[0,:]
406-
# ax2 = gs[1:,:]
405+
# ax1 = gs[0, :]
406+
# ax2 = gs[1:, :]
407407
# then drows0 = 1, and drowsC = 2, and ax2
408408
# should be at least twice as large as ax1.
409409
# But it can be more than twice as large because

lib/matplotlib/axes/_axes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5970,7 +5970,7 @@ def pcolormesh(self, *args, alpha=None, norm=None, cmap=None, vmin=None,
59705970
quad (i, j), (i+1, j), (i, j+1), (i+1, j+1) is given by
59715971
``C[i, j]``.
59725972
- 'gouraud': Each quad will be Gouraud shaded: The color of the
5973-
corners (i', j') are given by ``C[i',j']``. The color values of
5973+
corners (i', j') are given by ``C[i', j']``. The color values of
59745974
the area in between is interpolated from the corner values.
59755975
When Gouraud shading is used, *edgecolors* is ignored.
59765976
@@ -6309,7 +6309,7 @@ def hist(self, x, bins=None, range=None, density=False, weights=None,
63096309
63106310
Compute and draw the histogram of *x*. The return value is a tuple
63116311
(*n*, *bins*, *patches*) or ([*n0*, *n1*, ...], *bins*, [*patches0*,
6312-
*patches1*,...]) if the input contains multiple data. See the
6312+
*patches1*, ...]) if the input contains multiple data. See the
63136313
documentation of the *weights* parameter to draw a histogram of
63146314
already-binned data.
63156315

lib/matplotlib/contour.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1661,7 +1661,7 @@ def _initialize_x_y(self, z):
16611661
`.imshow`: it gives the outer pixel boundaries. In this case, the
16621662
position of Z[0, 0] is the center of the pixel, not a corner. If
16631663
*origin* is *None*, then (*x0*, *y0*) is the position of Z[0, 0],
1664-
and (*x1*, *y1*) is the position of Z[-1,-1].
1664+
and (*x1*, *y1*) is the position of Z[-1, -1].
16651665
16661666
This argument is ignored if *X* and *Y* are specified in the call
16671667
to contour.

lib/matplotlib/spines.py

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class Spine(mpatches.Patch):
1818
positions. See function:`~matplotlib.spines.Spine.set_position`
1919
for more information.
2020
21-
The default position is ``('outward',0)``.
21+
The default position is ``('outward', 0)``.
2222
2323
Spines are subclasses of class:`~matplotlib.patches.Patch`, and
2424
inherit much of their behavior.
@@ -379,28 +379,23 @@ def draw(self, renderer):
379379
return ret
380380

381381
def set_position(self, position):
382-
"""Set the position of the spine.
382+
"""
383+
Set the position of the spine.
383384
384385
Spine position is specified by a 2 tuple of (position type,
385386
amount). The position types are:
386387
387-
* 'outward' : place the spine out from the data area by the
388-
specified number of points. (Negative values specify placing the
389-
spine inward.)
390-
391-
* 'axes' : place the spine at the specified Axes coordinate (from
392-
0.0-1.0).
393-
394-
* 'data' : place the spine at the specified data coordinate.
388+
* 'outward': place the spine out from the data area by the specified
389+
number of points. (Negative values place the spine inwards.)
390+
* 'axes': place the spine at the specified Axes coordinate (0 to 1).
391+
* 'data': place the spine at the specified data coordinate.
395392
396393
Additionally, shorthand notations define a special positions:
397394
398-
* 'center' -> ('axes',0.5)
395+
* 'center' -> ('axes', 0.5)
399396
* 'zero' -> ('data', 0.0)
400-
401397
"""
402-
if position in ('center', 'zero'):
403-
# special positions
398+
if position in ('center', 'zero'): # special positions
404399
pass
405400
else:
406401
if len(position) != 2:
@@ -409,9 +404,7 @@ def set_position(self, position):
409404
raise ValueError("position[0] should be one of 'outward', "
410405
"'axes', or 'data' ")
411406
self._position = position
412-
413407
self.set_transform(self.get_spine_transform())
414-
415408
if self.axis is not None:
416409
self.axis.reset_ticks()
417410
self.stale = True

lib/matplotlib/textpath.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -385,8 +385,8 @@ def __init__(self, xy, s, size=None, prop=None,
385385
from matplotlib.font_manager import FontProperties
386386
387387
fp = FontProperties(family="Helvetica", style="italic")
388-
path1 = TextPath((12,12), "ABC", size=12, prop=fp)
389-
path2 = TextPath((0,0), r"$\frac{1}{2}$", size=12, usetex=True)
388+
path1 = TextPath((12, 12), "ABC", size=12, prop=fp)
389+
path2 = TextPath((0, 0), r"$\frac{1}{2}$", size=12, usetex=True)
390390
391391
Also see :doc:`/gallery/text_labels_and_annotations/demo_text_path`.
392392
"""

lib/matplotlib/tri/triangulation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def __init__(self, x, y, triangles=None, mask=None):
5858
# orientation.
5959
self.triangles = np.array(triangles, dtype=np.int32, order='C')
6060
if self.triangles.ndim != 2 or self.triangles.shape[1] != 3:
61-
raise ValueError('triangles must be a (?,3) array')
61+
raise ValueError('triangles must be a (?, 3) array')
6262
if self.triangles.max() >= len(self.x):
6363
raise ValueError('triangles max element is out of bounds')
6464
if self.triangles.min() < 0:
@@ -184,8 +184,8 @@ def neighbors(self):
184184
For each triangle, the indices of the three triangles that
185185
share the same edges, or -1 if there is no such neighboring
186186
triangle. ``neighbors[i, j]`` is the triangle that is the neighbor
187-
to the edge from point index ``triangles[i,j]`` to point index
188-
``triangles[i,(j+1)%3]``.
187+
to the edge from point index ``triangles[i, j]`` to point index
188+
``triangles[i, (j+1)%3]``.
189189
"""
190190
if self._neighbors is None:
191191
self._neighbors = self.get_cpp_triangulation().get_neighbors()

lib/matplotlib/tri/tricontour.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def tricontour(ax, *args, **kwargs):
206206
pixel boundaries. In this case, the position of Z[0, 0]
207207
is the center of the pixel, not a corner. If *origin* is
208208
*None*, then (*x0*, *y0*) is the position of Z[0, 0], and
209-
(*x1*, *y1*) is the position of Z[-1,-1].
209+
(*x1*, *y1*) is the position of Z[-1, -1].
210210
211211
This keyword is not active if *X* and *Y* are specified in
212212
the call to contour.

lib/matplotlib/tri/triinterpolate.py

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -492,16 +492,16 @@ def _get_alpha_vec(x, y, tris_pts):
492492
Parameters
493493
----------
494494
x, y : array-like of dim 1 (shape (nx,))
495-
Coordinates of the points whose points barycentric
496-
coordinates are requested
495+
Coordinates of the points whose points barycentric coordinates are
496+
requested.
497497
tris_pts : array like of dim 3 (shape: (nx, 3, 2))
498-
Coordinates of the containing triangles apexes.
498+
Coordinates of the containing triangles apexes.
499499
500500
Returns
501501
-------
502502
alpha : array of dim 2 (shape (nx, 3))
503-
Barycentric coordinates of the points inside the containing
504-
triangles.
503+
Barycentric coordinates of the points inside the containing
504+
triangles.
505505
"""
506506
ndim = tris_pts.ndim-2
507507

@@ -532,19 +532,19 @@ def _get_jacobian(tris_pts):
532532
Parameters
533533
----------
534534
tris_pts : array like of dim 3 (shape: (nx, 3, 2))
535-
Coordinates of the containing triangles apexes.
535+
Coordinates of the containing triangles apexes.
536536
537537
Returns
538538
-------
539539
J : array of dim 3 (shape (nx, 2, 2))
540-
Barycentric coordinates of the points inside the containing
541-
triangles.
542-
J[itri,:,:] is the jacobian matrix at apex 0 of the triangle
543-
itri, so that the following (matrix) relationship holds:
544-
[dz/dksi] = [J] x [dz/dx]
545-
with x: global coordinates
546-
ksi: element parametric coordinates in triangle first apex
547-
local basis.
540+
Barycentric coordinates of the points inside the containing
541+
triangles.
542+
J[itri, :, :] is the jacobian matrix at apex 0 of the triangle
543+
itri, so that the following (matrix) relationship holds:
544+
[dz/dksi] = [J] x [dz/dx]
545+
with x: global coordinates
546+
ksi: element parametric coordinates in triangle first apex
547+
local basis.
548548
"""
549549
a = np.array(tris_pts[:, 1, :] - tris_pts[:, 0, :])
550550
b = np.array(tris_pts[:, 2, :] - tris_pts[:, 0, :])
@@ -560,13 +560,13 @@ def _compute_tri_eccentricities(tris_pts):
560560
Parameters
561561
----------
562562
tris_pts : array like of dim 3 (shape: (nx, 3, 2))
563-
Coordinates of the triangles apexes.
563+
Coordinates of the triangles apexes.
564564
565565
Returns
566566
-------
567567
ecc : array like of dim 2 (shape: (nx, 3))
568-
The so-called eccentricity parameters [1] needed for
569-
HCT triangular element.
568+
The so-called eccentricity parameters [1] needed for HCT triangular
569+
element.
570570
"""
571571
a = np.expand_dims(tris_pts[:, 2, :] - tris_pts[:, 1, :], axis=2)
572572
b = np.expand_dims(tris_pts[:, 0, :] - tris_pts[:, 2, :], axis=2)
@@ -1008,8 +1008,8 @@ class _DOF_estimator:
10081008
Abstract base class for classes used to perform estimation of a function
10091009
first derivatives, and deduce the dofs for a CubicTriInterpolator using a
10101010
reduced HCT element formulation.
1011-
Derived classes implement compute_df(self,**kwargs), returning
1012-
np.vstack([dfx,dfy]).T where : dfx, dfy are the estimation of the 2
1011+
Derived classes implement ``compute_df(self, **kwargs)``, returning
1012+
``np.vstack([dfx, dfy]).T`` where ``dfx, dfy`` are the estimation of the 2
10131013
gradient coordinates.
10141014
"""
10151015
def __init__(self, interpolator, **kwargs):
@@ -1160,7 +1160,7 @@ def compute_geom_grads(self):
11601160
dZ = np.vstack([dZ1, dZ2]).T
11611161
df = np.empty_like(dZ)
11621162

1163-
# With np.einsum : could be ej,eji -> ej
1163+
# With np.einsum: could be ej,eji -> ej
11641164
df[:, 0] = dZ[:, 0]*dM_inv[:, 0, 0] + dZ[:, 1]*dM_inv[:, 1, 0]
11651165
df[:, 1] = dZ[:, 0]*dM_inv[:, 0, 1] + dZ[:, 1]*dM_inv[:, 1, 1]
11661166
return df
@@ -1585,8 +1585,9 @@ def _extract_submatrices(M, block_indices, block_size, axis):
15851585
Extracts selected blocks of a matrices *M* depending on parameters
15861586
*block_indices* and *block_size*.
15871587
1588-
Returns the array of extracted matrices *Mres* so that:
1589-
M_res[...,ir,:] = M[(block_indices*block_size+ir), :]
1588+
Returns the array of extracted matrices *Mres* so that ::
1589+
1590+
M_res[..., ir, :] = M[(block_indices*block_size+ir), :]
15901591
"""
15911592
assert block_indices.ndim == 1
15921593
assert axis in [0, 1]

lib/mpl_toolkits/axisartist/axis_artist.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
--------------
4343
4444
`AxisArtist`, `AxisLabel`, `TickLabels` have an *axis_direction* attribute,
45-
which adjusts the location, angle, etc.,. The *axis_direction* must be one of
45+
which adjusts the location, angle, etc. The *axis_direction* must be one of
4646
"left", "right", "bottom", "top", and follows the Matplotlib convention for
4747
rectangular axis.
4848

lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2490,7 +2490,7 @@ def quiver(self, *args,
24902490
:class:`~matplotlib.collections.LineCollection`
24912491
"""
24922492
def calc_arrows(UVW, angle=15):
2493-
# get unit direction vector perpendicular to (u,v,w)
2493+
# get unit direction vector perpendicular to (u, v, w)
24942494
x = UVW[:, 0]
24952495
y = UVW[:, 1]
24962496
norm = np.linalg.norm(UVW[:, :2], axis=1)

tutorials/colors/colormap-manipulation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@ def plot_examples(colormaps):
155155

156156
##############################################################################
157157
# Of course we need not start from a named colormap, we just need to create
158-
# the Nx4 array to pass to `.ListedColormap`. Here we create a
159-
# colormap that goes from brown (RGB: 90,40,40) to white (RGB: 255,255,255).
158+
# the Nx4 array to pass to `.ListedColormap`. Here we create a colormap that
159+
# goes from brown (RGB: 90, 40, 40) to white (RGB: 255, 255, 255).
160160

161161
N = 256
162162
vals = np.ones((N, 4))

0 commit comments

Comments
 (0)