Parameters ---------- verts : list of (N, 3) array-like The sequence of polygons [*verts0*, *verts1*, ...] where each element *verts_i* defines the vertices of polygon *i* as a 2D array-like of shape (N, 3). zsort : {'average', 'mi
(self, verts, *args, zsort='average', shade=False,
lightsource=None, axlim_clip=False, **kwargs)
| 1248 | """ |
| 1249 | |
| 1250 | def __init__(self, verts, *args, zsort='average', shade=False, |
| 1251 | lightsource=None, axlim_clip=False, **kwargs): |
| 1252 | """ |
| 1253 | Parameters |
| 1254 | ---------- |
| 1255 | verts : list of (N, 3) array-like |
| 1256 | The sequence of polygons [*verts0*, *verts1*, ...] where each |
| 1257 | element *verts_i* defines the vertices of polygon *i* as a 2D |
| 1258 | array-like of shape (N, 3). |
| 1259 | zsort : {'average', 'min', 'max'}, default: 'average' |
| 1260 | The calculation method for the z-order. |
| 1261 | See `~.Poly3DCollection.set_zsort` for details. |
| 1262 | shade : bool, default: False |
| 1263 | Whether to shade *facecolors* and *edgecolors*. When activating |
| 1264 | *shade*, *facecolors* and/or *edgecolors* must be provided. |
| 1265 | |
| 1266 | .. versionadded:: 3.7 |
| 1267 | |
| 1268 | lightsource : `~matplotlib.colors.LightSource`, optional |
| 1269 | The lightsource to use when *shade* is True. |
| 1270 | |
| 1271 | .. versionadded:: 3.7 |
| 1272 | |
| 1273 | axlim_clip : bool, default: False |
| 1274 | Whether to hide polygons with a vertex outside the view limits. |
| 1275 | |
| 1276 | .. versionadded:: 3.10 |
| 1277 | |
| 1278 | *args, **kwargs |
| 1279 | All other parameters are forwarded to `.PolyCollection`. |
| 1280 | |
| 1281 | Notes |
| 1282 | ----- |
| 1283 | Note that this class does a bit of magic with the _facecolors |
| 1284 | and _edgecolors properties. |
| 1285 | """ |
| 1286 | if shade: |
| 1287 | normals = _generate_normals(verts) |
| 1288 | facecolors = kwargs.get('facecolors', None) |
| 1289 | if facecolors is not None: |
| 1290 | kwargs['facecolors'] = _shade_colors( |
| 1291 | facecolors, normals, lightsource |
| 1292 | ) |
| 1293 | |
| 1294 | edgecolors = kwargs.get('edgecolors', None) |
| 1295 | if edgecolors is not None: |
| 1296 | kwargs['edgecolors'] = _shade_colors( |
| 1297 | edgecolors, normals, lightsource |
| 1298 | ) |
| 1299 | if facecolors is None and edgecolors is None: |
| 1300 | raise ValueError( |
| 1301 | "You must provide facecolors, edgecolors, or both for " |
| 1302 | "shade to work.") |
| 1303 | super().__init__(verts, *args, **kwargs) |
| 1304 | if isinstance(verts, np.ndarray): |
| 1305 | if verts.ndim != 3: |
| 1306 | raise ValueError('verts must be a list of (N, 3) array-like') |
| 1307 | else: |
nothing calls this directly
no test coverage detected