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

Skip to content

Commit 3cd073f

Browse files
committed
Improve docstrings
1 parent 9c2cf4c commit 3cd073f

1 file changed

Lines changed: 15 additions & 6 deletions

File tree

lib/matplotlib/backends/backend_pdf.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,9 +1262,11 @@ def imageObject(self, image):
12621262
return name
12631263

12641264
def _unpack(self, im):
1265-
"""Unpack the image object im into height, width, data, alpha,
1265+
"""
1266+
Unpack the image object im into height, width, data, alpha,
12661267
where data and alpha are HxWx3 (RGB) or HxWx1 (grayscale or alpha)
1267-
arrays, except alpha is None if the image is fully opaque."""
1268+
arrays, except alpha is None if the image is fully opaque.
1269+
"""
12681270

12691271
h, w, s = im.as_rgba_str()
12701272
rgba = np.fromstring(s, np.uint8)
@@ -1285,8 +1287,11 @@ def _unpack(self, im):
12851287
return h, w, rgb, alpha
12861288

12871289
def _writePng(self, data):
1288-
"""Write the image *data* into the pdf file using png
1289-
predictors with Flate compression."""
1290+
"""
1291+
Write the image *data* into the pdf file using png
1292+
predictors with Flate compression.
1293+
"""
1294+
12901295
buffer = BytesIO()
12911296
_png.write_png(data, buffer)
12921297
buffer.seek(8)
@@ -1309,9 +1314,13 @@ def _writePng(self, data):
13091314
buffer.seek(4, 1) # skip CRC
13101315

13111316
def _writeImg(self, data, height, width, grayscale, id, smask=None):
1312-
"""Write the image *data* of size *height* x *width*, as grayscale
1317+
"""
1318+
Write the image *data* of size *height* x *width*, as grayscale
13131319
if *grayscale* is true and RGB otherwise, as pdf object *id*
1314-
and with the soft mask (alpha channel) *smask*."""
1320+
and with the soft mask (alpha channel) *smask*, which should be
1321+
either None or a *height* x *width* x 1 array.
1322+
"""
1323+
13151324
obj = {'Type': Name('XObject'),
13161325
'Subtype': Name('Image'),
13171326
'Width': width,

0 commit comments

Comments
 (0)