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

Skip to content

Commit cce331d

Browse files
authored
Merge pull request #16283 from anntzer/aggd
Cleanup backend_agg docstrings.
2 parents 75d3c9b + ae75669 commit cce331d

File tree

1 file changed

+25
-45
lines changed

1 file changed

+25
-45
lines changed

lib/matplotlib/backends/backend_agg.py

Lines changed: 25 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
11
"""
2-
An agg http://antigrain.com/ backend
2+
An agg_ backend.
33
4-
Features that are implemented
4+
.. _agg: http://antigrain.com/
55
6-
* capstyles and join styles
7-
* dashes
8-
* linewidth
9-
* lines, rectangles, ellipses
10-
* clipping to a rectangle
11-
* output to RGBA and Pillow-supported image formats
12-
* alpha blending
13-
* DPI scaling properly - everything scales properly (dashes, linewidths, etc)
14-
* draw polygon
15-
* freetype2 w/ ft2font
6+
Features that are implemented:
167
17-
TODO:
8+
* capstyles and join styles
9+
* dashes
10+
* linewidth
11+
* lines, rectangles, ellipses
12+
* clipping to a rectangle
13+
* output to RGBA and Pillow-supported image formats
14+
* alpha blending
15+
* DPI scaling properly - everything scales properly (dashes, linewidths, etc)
16+
* draw polygon
17+
* freetype2 w/ ft2font
1818
19-
* integrate screen dpi w/ ppi and text
19+
TODO:
2020
21+
* integrate screen dpi w/ ppi and text
2122
"""
23+
2224
try:
2325
import threading
2426
except ImportError:
@@ -151,9 +153,7 @@ def draw_path(self, gc, path, transform, rgbFace=None):
151153
"'agg.path.chunksize' rcparam)")
152154

153155
def draw_mathtext(self, gc, x, y, s, prop, angle):
154-
"""
155-
Draw the math text using matplotlib.mathtext
156-
"""
156+
"""Draw mathtext using :mod:`matplotlib.mathtext`."""
157157
ox, oy, width, height, descent, font_image, used_characters = \
158158
self.mathtext_parser.parse(s, self.dpi, prop)
159159

@@ -358,16 +358,7 @@ def post_processing(image, dpi):
358358

359359

360360
class FigureCanvasAgg(FigureCanvasBase):
361-
"""
362-
The canvas the figure renders into. Calls the draw and print fig
363-
methods, creates the renderers, etc...
364-
365-
Attributes
366-
----------
367-
figure : `matplotlib.figure.Figure`
368-
A high-level Figure instance
369-
370-
"""
361+
# docstring inherited
371362

372363
def copy_from_bbox(self, bbox):
373364
renderer = self.get_renderer()
@@ -378,9 +369,7 @@ def restore_region(self, region, bbox=None, xy=None):
378369
return renderer.restore_region(region, bbox, xy)
379370

380371
def draw(self):
381-
"""
382-
Draw the figure using the renderer.
383-
"""
372+
# docstring inherited
384373
self.renderer = self.get_renderer(cleared=True)
385374
# Acquire a lock on the shared font cache.
386375
with RendererAgg.lock, \
@@ -404,38 +393,29 @@ def get_renderer(self, cleared=False):
404393
return self.renderer
405394

406395
def tostring_rgb(self):
407-
"""Get the image as an RGB byte string.
396+
"""
397+
Get the image as RGB `bytes`.
408398
409399
`draw` must be called at least once before this function will work and
410400
to update the renderer for any subsequent changes to the Figure.
411-
412-
Returns
413-
-------
414-
bytes
415401
"""
416402
return self.renderer.tostring_rgb()
417403

418404
def tostring_argb(self):
419-
"""Get the image as an ARGB byte string.
405+
"""
406+
Get the image as ARGB `bytes`.
420407
421408
`draw` must be called at least once before this function will work and
422409
to update the renderer for any subsequent changes to the Figure.
423-
424-
Returns
425-
-------
426-
bytes
427410
"""
428411
return self.renderer.tostring_argb()
429412

430413
def buffer_rgba(self):
431-
"""Get the image as a memoryview to the renderer's buffer.
414+
"""
415+
Get the image as a `memoryview` to the renderer's buffer.
432416
433417
`draw` must be called at least once before this function will work and
434418
to update the renderer for any subsequent changes to the Figure.
435-
436-
Returns
437-
-------
438-
memoryview
439419
"""
440420
return self.renderer.buffer_rgba()
441421

0 commit comments

Comments
 (0)