Convert a `.PatchCollection` into a `.Patch3DCollection` object (or a `.PathCollection` into a `.Path3DCollection` object). Parameters ---------- col : `~matplotlib.collections.PatchCollection` or \ `~matplotlib.collections.PathCollection` The collection to convert.
(
col,
zs=0,
zdir="z",
depthshade=None,
axlim_clip=False,
*args,
depthshade_minalpha=None,
)
| 1176 | |
| 1177 | |
| 1178 | def patch_collection_2d_to_3d( |
| 1179 | col, |
| 1180 | zs=0, |
| 1181 | zdir="z", |
| 1182 | depthshade=None, |
| 1183 | axlim_clip=False, |
| 1184 | *args, |
| 1185 | depthshade_minalpha=None, |
| 1186 | ): |
| 1187 | """ |
| 1188 | Convert a `.PatchCollection` into a `.Patch3DCollection` object |
| 1189 | (or a `.PathCollection` into a `.Path3DCollection` object). |
| 1190 | |
| 1191 | Parameters |
| 1192 | ---------- |
| 1193 | col : `~matplotlib.collections.PatchCollection` or \ |
| 1194 | `~matplotlib.collections.PathCollection` |
| 1195 | The collection to convert. |
| 1196 | zs : float or array of floats |
| 1197 | The location or locations to place the patches in the collection along |
| 1198 | the *zdir* axis. Default: 0. |
| 1199 | zdir : {'x', 'y', 'z'} |
| 1200 | The axis in which to place the patches. Default: "z". |
| 1201 | See `.get_dir_vector` for a description of the values. |
| 1202 | depthshade : bool, default: :rc:`axes3d.depthshade` |
| 1203 | Whether to shade the patches to give a sense of depth. |
| 1204 | axlim_clip : bool, default: False |
| 1205 | Whether to hide patches with a vertex outside the axes view limits. |
| 1206 | |
| 1207 | .. versionadded:: 3.10 |
| 1208 | |
| 1209 | depthshade_minalpha : float, default: :rc:`axes3d.depthshade_minalpha` |
| 1210 | Sets the minimum alpha value used by depth-shading. |
| 1211 | |
| 1212 | .. versionadded:: 3.11 |
| 1213 | """ |
| 1214 | if isinstance(col, PathCollection): |
| 1215 | col.__class__ = Path3DCollection |
| 1216 | col._offset_zordered = None |
| 1217 | elif isinstance(col, PatchCollection): |
| 1218 | col.__class__ = Patch3DCollection |
| 1219 | if depthshade is None: |
| 1220 | depthshade = rcParams['axes3d.depthshade'] |
| 1221 | if depthshade_minalpha is None: |
| 1222 | depthshade_minalpha = rcParams['axes3d.depthshade_minalpha'] |
| 1223 | col._depthshade = depthshade |
| 1224 | col._depthshade_minalpha = depthshade_minalpha |
| 1225 | col._in_draw = False |
| 1226 | col.set_3d_properties(zs, zdir, axlim_clip) |
| 1227 | |
| 1228 | |
| 1229 | class Poly3DCollection(PolyCollection): |
nothing calls this directly
no test coverage detected
searching dependent graphs…