@@ -151,20 +151,20 @@ class RendererBase:
151
151
An abstract base class to handle drawing/rendering operations.
152
152
153
153
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):
156
156
157
- * :meth: `draw_path`
158
- * :meth: `draw_image`
159
- * :meth: `draw_gouraud_triangle`
157
+ * `draw_path`
158
+ * `draw_image`
159
+ * `draw_gouraud_triangle`
160
160
161
161
The following methods *should* be implemented in the backend for
162
162
optimization reasons:
163
163
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`
168
168
"""
169
169
170
170
def __init__ (self ):
@@ -197,10 +197,9 @@ def draw_markers(self, gc, marker_path, marker_trans, path,
197
197
"""
198
198
Draw a marker at each of *path*'s vertices (excluding control points).
199
199
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.
204
203
205
204
Parameters
206
205
----------
@@ -234,17 +233,14 @@ def draw_path_collection(self, gc, master_transform, paths, all_transforms,
234
233
*offset_position* is unused now, but the argument is kept for
235
234
backwards compatibility.
236
235
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.
248
244
"""
249
245
path_ids = self ._iter_collection_raw_paths (master_transform ,
250
246
paths , all_transforms )
@@ -268,8 +264,10 @@ def draw_quad_mesh(self, gc, master_transform, meshWidth, meshHeight,
268
264
coordinates , offsets , offsetTrans , facecolors ,
269
265
antialiased , edgecolors ):
270
266
"""
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`.
273
271
"""
274
272
275
273
from matplotlib .collections import QuadMesh
@@ -321,18 +319,17 @@ def draw_gouraud_triangles(self, gc, triangles_array, colors_array,
321
319
def _iter_collection_raw_paths (self , master_transform , paths ,
322
320
all_transforms ):
323
321
"""
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.
326
324
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.
330
327
331
328
The arguments should be exactly what is passed in to
332
- :meth: `draw_path_collection`.
329
+ `draw_path_collection`.
333
330
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.
336
333
"""
337
334
Npaths = len (paths )
338
335
Ntransforms = len (all_transforms )
@@ -352,8 +349,8 @@ def _iter_collection_uses_per_path(self, paths, all_transforms,
352
349
offsets , facecolors , edgecolors ):
353
350
"""
354
351
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
357
354
on the tradeoff between using the paths in-line and storing
358
355
them once and reusing. Rounds up in case the number of uses
359
356
is not the same for every path.
@@ -370,19 +367,18 @@ def _iter_collection(self, gc, master_transform, all_transforms,
370
367
edgecolors , linewidths , linestyles ,
371
368
antialiaseds , urls , offset_position ):
372
369
"""
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.
375
372
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.
380
377
381
378
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.
386
382
387
383
Each yielded result is of the form::
388
384
@@ -451,7 +447,7 @@ def _iter_collection(self, gc, master_transform, all_transforms,
451
447
452
448
def get_image_magnification (self ):
453
449
"""
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`.
455
451
Allows a backend to have images at a different resolution to other
456
452
artists.
457
453
"""
@@ -479,14 +475,13 @@ def draw_image(self, gc, x, y, im, transform=None):
479
475
480
476
transform : `matplotlib.transforms.Affine2DBase`
481
477
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*).
490
485
"""
491
486
raise NotImplementedError
492
487
@@ -502,8 +497,8 @@ def option_image_nocomposite(self):
502
497
503
498
def option_scale_image (self ):
504
499
"""
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).
507
502
"""
508
503
return False
509
504
@@ -514,7 +509,7 @@ def draw_tex(self, gc, x, y, s, prop, angle, *, mtext=None):
514
509
515
510
def draw_text (self , gc , x , y , s , prop , angle , ismath = False , mtext = None ):
516
511
"""
517
- Draw the text instance.
512
+ Draw a text instance.
518
513
519
514
Parameters
520
515
----------
0 commit comments