Skip to content

Commit 842a172

Browse files
committed
Formatting
1 parent a8178eb commit 842a172

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

lib/matplotlib/backends/backend_pdf.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,13 +1222,13 @@ def alphaState(self, alpha):
12221222
return name
12231223

12241224
def _soft_mask_state(self, smask):
1225-
"""Return the name of an ExtGState that sets the soft mask to the given shading.
1225+
"""Return an ExtGState that sets the soft mask to the given shading.
12261226
12271227
Parameters
12281228
----------
12291229
smask : Reference
1230-
reference to a shading in DeviceGray color space, whose luminosity is
1231-
to be used as the alpha channel
1230+
Reference to a shading in DeviceGray color space, whose luminosity
1231+
is to be used as the alpha channel.
12321232
12331233
Returns
12341234
-------
@@ -1286,7 +1286,7 @@ def _write_soft_mask_groups(self):
12861286
self.beginStream(ob.id, None, attributes)
12871287
self.output(*content)
12881288
self.endStream()
1289-
1289+
12901290
def hatchPattern(self, hatch_style):
12911291
# The colors may come in as numpy arrays, which aren't hashable
12921292
if hatch_style is not None:
@@ -1350,11 +1350,12 @@ def addGouraudTriangles(self, points, colors):
13501350
----------
13511351
13521352
points : np.ndarray
1353-
triangle vertices, shape (n, 3, 2)
1354-
where n = number of triangles, 3 = vertices, 2 = x, y
1353+
Triangle vertices, shape (n, 3, 2)
1354+
where n = number of triangles, 3 = vertices, 2 = x, y.
13551355
colors : np.ndarray
1356-
vertex colors, shape (n, 3, 1) or (n, 3, 4)
1357-
as with points, but last dimension is either (gray,) or (r, g, b, alpha)
1356+
Vertex colors, shape (n, 3, 1) or (n, 3, 4)
1357+
as with points, but last dimension is either (gray,)
1358+
or (r, g, b, alpha).
13581359
13591360
Returns
13601361
-------
@@ -1387,9 +1388,12 @@ def writeGouraudTriangles(self):
13871388
'BitsPerCoordinate': 32,
13881389
'BitsPerComponent': 8,
13891390
'BitsPerFlag': 8,
1390-
'ColorSpace': Name('DeviceRGB' if colordim == 3 else 'DeviceGray'),
1391+
'ColorSpace': Name(
1392+
'DeviceRGB' if colordim == 3 else 'DeviceGray'
1393+
),
13911394
'AntiAlias': False,
1392-
'Decode': ([points_min[0], points_max[0], points_min[1], points_max[1]]
1395+
'Decode': ([points_min[0], points_max[0],
1396+
points_min[1], points_max[1]]
13931397
+ [0, 1] * colordim),
13941398
})
13951399

@@ -1904,21 +1908,21 @@ def draw_gouraud_triangles(self, gc, points, colors, trans):
19041908
assert colors.ndim == 3
19051909
assert colors.shape[1] == 3
19061910
assert colors.shape[2] in (1, 4)
1907-
1911+
19081912
shape = points.shape
19091913
points = points.reshape((shape[0] * shape[1], 2))
19101914
tpoints = trans.transform(points)
19111915
tpoints = tpoints.reshape(shape)
19121916
name, _ = self.file.addGouraudTriangles(tpoints, colors)
19131917
output = self.file.output
1914-
1918+
19151919
if colors.shape[2] == 1:
19161920
# grayscale
19171921
gc.set_alpha(1.0)
19181922
self.check_gc(gc)
19191923
output(name, Op.shading)
19201924
return
1921-
1925+
19221926
alpha = colors[0, 0, 3]
19231927
if np.allclose(alpha, colors[:, :, 3]):
19241928
# single alpha value

0 commit comments

Comments
 (0)