r""" Base class for Collections. Must be subclassed to be usable. A Collection represents a sequence of `.Patch`\es that can be drawn more efficiently together than individually. For example, when a single path is being drawn repeatedly at different offsets, the renderer can typ
| 34 | "offset_transform": ["transOffset"], |
| 35 | }) |
| 36 | class Collection(mcolorizer.ColorizingArtist): |
| 37 | r""" |
| 38 | Base class for Collections. Must be subclassed to be usable. |
| 39 | |
| 40 | A Collection represents a sequence of `.Patch`\es that can be drawn |
| 41 | more efficiently together than individually. For example, when a single |
| 42 | path is being drawn repeatedly at different offsets, the renderer can |
| 43 | typically execute a ``draw_marker()`` call much more efficiently than a |
| 44 | series of repeated calls to ``draw_path()`` with the offsets put in |
| 45 | one-by-one. |
| 46 | |
| 47 | Most properties of a collection can be configured per-element. Therefore, |
| 48 | Collections have "plural" versions of many of the properties of a `.Patch` |
| 49 | (e.g. `.Collection.get_paths` instead of `.Patch.get_path`). Exceptions are |
| 50 | the *zorder*, *hatch*, *pickradius*, *capstyle* and *joinstyle* properties, |
| 51 | which can only be set globally for the whole collection. |
| 52 | |
| 53 | Besides these exceptions, all properties can be specified as single values |
| 54 | (applying to all elements) or sequences of values. The property of the |
| 55 | ``i``\th element of the collection is:: |
| 56 | |
| 57 | prop[i % len(prop)] |
| 58 | |
| 59 | Each Collection can optionally be used as its own `.ScalarMappable` by |
| 60 | passing the *norm* and *cmap* parameters to its constructor. If the |
| 61 | Collection's `.ScalarMappable` matrix ``_A`` has been set (via a call |
| 62 | to `.Collection.set_array`), then at draw time this internal scalar |
| 63 | mappable will be used to set the ``facecolors`` and ``edgecolors``, |
| 64 | ignoring those that were manually passed in. |
| 65 | """ |
| 66 | #: Either a list of 3x3 arrays or an Nx3x3 array (representing N |
| 67 | #: transforms), suitable for the `all_transforms` argument to |
| 68 | #: `~matplotlib.backend_bases.RendererBase.draw_path_collection`; |
| 69 | #: each 3x3 array is used to initialize an |
| 70 | #: `~matplotlib.transforms.Affine2D` object. |
| 71 | #: Each kind of collection defines this based on its arguments. |
| 72 | _transforms = np.empty((0, 3, 3)) |
| 73 | |
| 74 | # Whether to draw an edge by default. Set on a |
| 75 | # subclass-by-subclass basis. |
| 76 | _edge_default = False |
| 77 | |
| 78 | @_docstring.interpd |
| 79 | def __init__(self, *, |
| 80 | edgecolors=None, |
| 81 | facecolors=None, |
| 82 | hatchcolors=None, |
| 83 | linewidths=None, |
| 84 | linestyles='solid', |
| 85 | capstyle=None, |
| 86 | joinstyle=None, |
| 87 | antialiaseds=None, |
| 88 | offsets=None, |
| 89 | offset_transform=None, |
| 90 | norm=None, # optional for ScalarMappable |
| 91 | cmap=None, # ditto |
| 92 | colorizer=None, |
| 93 | pickradius=5.0, |
no outgoing calls
searching dependent graphs…