Skip to content

Commit 1d32ebb

Browse files
committed
Slightly cleanup RendererBase docs.
Remove unnecessary markup, slight rewordings.
1 parent 085fdd0 commit 1d32ebb

File tree

1 file changed

+53
-58
lines changed

1 file changed

+53
-58
lines changed

lib/matplotlib/backend_bases.py

Lines changed: 53 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -151,20 +151,20 @@ class RendererBase:
151151
An abstract base class to handle drawing/rendering operations.
152152
153153
The following methods must be implemented in the backend for full
154-
functionality (though just implementing :meth:`draw_path` alone would
155-
give a highly capable backend):
154+
functionality (though just implementing `draw_path` alone would give a
155+
highly capable backend):
156156
157-
* :meth:`draw_path`
158-
* :meth:`draw_image`
159-
* :meth:`draw_gouraud_triangle`
157+
* `draw_path`
158+
* `draw_image`
159+
* `draw_gouraud_triangle`
160160
161161
The following methods *should* be implemented in the backend for
162162
optimization reasons:
163163
164-
* :meth:`draw_text`
165-
* :meth:`draw_markers`
166-
* :meth:`draw_path_collection`
167-
* :meth:`draw_quad_mesh`
164+
* `draw_text`
165+
* `draw_markers`
166+
* `draw_path_collection`
167+
* `draw_quad_mesh`
168168
"""
169169

170170
def __init__(self):
@@ -197,10 +197,9 @@ def draw_markers(self, gc, marker_path, marker_trans, path,
197197
"""
198198
Draw a marker at each of *path*'s vertices (excluding control points).
199199
200-
This provides a fallback implementation of draw_markers that
201-
makes multiple calls to :meth:`draw_path`. Some backends may
202-
want to override this method in order to draw the marker only
203-
once and reuse it multiple times.
200+
The base (fallback) implementation makes multiple calls to `draw_path`.
201+
Backends may want to override this method in order to draw the marker
202+
only once and reuse it multiple times.
204203
205204
Parameters
206205
----------
@@ -234,17 +233,14 @@ def draw_path_collection(self, gc, master_transform, paths, all_transforms,
234233
*offset_position* is unused now, but the argument is kept for
235234
backwards compatibility.
236235
237-
This provides a fallback implementation of
238-
:meth:`draw_path_collection` that makes multiple calls to
239-
:meth:`draw_path`. Some backends may want to override this in
240-
order to render each set of path data only once, and then
241-
reference that path multiple times with the different offsets,
242-
colors, styles etc. The generator methods
243-
:meth:`_iter_collection_raw_paths` and
244-
:meth:`_iter_collection` are provided to help with (and
245-
standardize) the implementation across backends. It is highly
246-
recommended to use those generators, so that changes to the
247-
behavior of :meth:`draw_path_collection` can be made globally.
236+
The base (fallback) implementation makes multiple calls to `draw_path`.
237+
Backends may want to override this in order to render each set of
238+
path data only once, and then reference that path multiple times with
239+
the different offsets, colors, styles etc. The generator methods
240+
`_iter_collection_raw_paths` and `_iter_collection` are provided to
241+
help with (and standardize) the implementation across backends. It
242+
is highly recommended to use those generators, so that changes to the
243+
behavior of `draw_path_collection` can be made globally.
248244
"""
249245
path_ids = self._iter_collection_raw_paths(master_transform,
250246
paths, all_transforms)
@@ -268,8 +264,10 @@ def draw_quad_mesh(self, gc, master_transform, meshWidth, meshHeight,
268264
coordinates, offsets, offsetTrans, facecolors,
269265
antialiased, edgecolors):
270266
"""
271-
Fallback implementation of :meth:`draw_quad_mesh` that generates paths
272-
and then calls :meth:`draw_path_collection`.
267+
Draw a quadmesh.
268+
269+
The base (fallback) implementation converts the quadmesh to paths and
270+
then calls `draw_path_collection`.
273271
"""
274272

275273
from matplotlib.collections import QuadMesh
@@ -321,18 +319,17 @@ def draw_gouraud_triangles(self, gc, triangles_array, colors_array,
321319
def _iter_collection_raw_paths(self, master_transform, paths,
322320
all_transforms):
323321
"""
324-
Helper method (along with :meth:`_iter_collection`) to implement
325-
:meth:`draw_path_collection` in a space-efficient manner.
322+
Helper method (along with `_iter_collection`) to implement
323+
`draw_path_collection` in a memory-efficient manner.
326324
327-
This method yields all of the base path/transform
328-
combinations, given a master transform, a list of paths and
329-
list of transforms.
325+
This method yields all of the base path/transform combinations, given a
326+
master transform, a list of paths and list of transforms.
330327
331328
The arguments should be exactly what is passed in to
332-
:meth:`draw_path_collection`.
329+
`draw_path_collection`.
333330
334-
The backend should take each yielded path and transform and
335-
create an object that can be referenced (reused) later.
331+
The backend should take each yielded path and transform and create an
332+
object that can be referenced (reused) later.
336333
"""
337334
Npaths = len(paths)
338335
Ntransforms = len(all_transforms)
@@ -352,8 +349,8 @@ def _iter_collection_uses_per_path(self, paths, all_transforms,
352349
offsets, facecolors, edgecolors):
353350
"""
354351
Compute how many times each raw path object returned by
355-
_iter_collection_raw_paths would be used when calling
356-
_iter_collection. This is intended for the backend to decide
352+
`_iter_collection_raw_paths` would be used when calling
353+
`_iter_collection`. This is intended for the backend to decide
357354
on the tradeoff between using the paths in-line and storing
358355
them once and reusing. Rounds up in case the number of uses
359356
is not the same for every path.
@@ -370,19 +367,18 @@ def _iter_collection(self, gc, master_transform, all_transforms,
370367
edgecolors, linewidths, linestyles,
371368
antialiaseds, urls, offset_position):
372369
"""
373-
Helper method (along with :meth:`_iter_collection_raw_paths`) to
374-
implement :meth:`draw_path_collection` in a space-efficient manner.
370+
Helper method (along with `_iter_collection_raw_paths`) to implement
371+
`draw_path_collection` in a memory-efficient manner.
375372
376-
This method yields all of the path, offset and graphics
377-
context combinations to draw the path collection. The caller
378-
should already have looped over the results of
379-
:meth:`_iter_collection_raw_paths` to draw this collection.
373+
This method yields all of the path, offset and graphics context
374+
combinations to draw the path collection. The caller should already
375+
have looped over the results of `_iter_collection_raw_paths` to draw
376+
this collection.
380377
381378
The arguments should be the same as that passed into
382-
:meth:`draw_path_collection`, with the exception of
383-
*path_ids*, which is a list of arbitrary objects that the
384-
backend will use to reference one of the paths created in the
385-
:meth:`_iter_collection_raw_paths` stage.
379+
`draw_path_collection`, with the exception of *path_ids*, which is a
380+
list of arbitrary objects that the backend will use to reference one of
381+
the paths created in the `_iter_collection_raw_paths` stage.
386382
387383
Each yielded result is of the form::
388384
@@ -451,7 +447,7 @@ def _iter_collection(self, gc, master_transform, all_transforms,
451447

452448
def get_image_magnification(self):
453449
"""
454-
Get the factor by which to magnify images passed to :meth:`draw_image`.
450+
Get the factor by which to magnify images passed to `draw_image`.
455451
Allows a backend to have images at a different resolution to other
456452
artists.
457453
"""
@@ -479,14 +475,13 @@ def draw_image(self, gc, x, y, im, transform=None):
479475
480476
transform : `matplotlib.transforms.Affine2DBase`
481477
If and only if the concrete backend is written such that
482-
:meth:`option_scale_image` returns ``True``, an affine
483-
transformation (i.e., an `.Affine2DBase`) *may* be passed to
484-
:meth:`draw_image`. The translation vector of the transformation
485-
is given in physical units (i.e., dots or pixels). Note that
486-
the transformation does not override *x* and *y*, and has to be
487-
applied *before* translating the result by *x* and *y* (this can
488-
be accomplished by adding *x* and *y* to the translation vector
489-
defined by *transform*).
478+
`option_scale_image` returns ``True``, an affine transformation
479+
(i.e., an `.Affine2DBase`) *may* be passed to `draw_image`. The
480+
translation vector of the transformation is given in physical units
481+
(i.e., dots or pixels). Note that the transformation does not
482+
override *x* and *y*, and has to be applied *before* translating
483+
the result by *x* and *y* (this can be accomplished by adding *x*
484+
and *y* to the translation vector defined by *transform*).
490485
"""
491486
raise NotImplementedError
492487

@@ -502,8 +497,8 @@ def option_image_nocomposite(self):
502497

503498
def option_scale_image(self):
504499
"""
505-
Return whether arbitrary affine transformations in :meth:`draw_image`
506-
are supported (True for most vector backends).
500+
Return whether arbitrary affine transformations in `draw_image` are
501+
supported (True for most vector backends).
507502
"""
508503
return False
509504

@@ -514,7 +509,7 @@ def draw_tex(self, gc, x, y, s, prop, angle, *, mtext=None):
514509

515510
def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
516511
"""
517-
Draw the text instance.
512+
Draw a text instance.
518513
519514
Parameters
520515
----------

0 commit comments

Comments
 (0)