MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / set_3d_properties

Method set_3d_properties

lib/mpl_toolkits/mplot3d/art3d.py:995–1045  ·  view source on GitHub ↗

Set the *z* positions and direction of the paths. Parameters ---------- zs : float or array of floats The location or locations to place the paths in the collection along the *zdir* axis. zdir : {'x', 'y', 'z'} Plane to pl

(self, zs, zdir, axlim_clip=False)

Source from the content-addressed store, hash-verified

993 self.stale = True
994
995 def set_3d_properties(self, zs, zdir, axlim_clip=False):
996 """
997 Set the *z* positions and direction of the paths.
998
999 Parameters
1000 ----------
1001 zs : float or array of floats
1002 The location or locations to place the paths in the collection
1003 along the *zdir* axis.
1004 zdir : {'x', 'y', 'z'}
1005 Plane to plot paths orthogonal to.
1006 All paths must have the same direction.
1007 See `.get_dir_vector` for a description of the values.
1008 axlim_clip : bool, default: False
1009 Whether to hide paths with a vertex outside the axes view limits.
1010
1011 .. versionadded:: 3.10
1012 """
1013 # Force the collection to initialize the face and edgecolors
1014 # just in case it is a scalarmappable with a colormap.
1015 self.update_scalarmappable()
1016 offsets = self.get_offsets()
1017 if len(offsets) > 0:
1018 xs, ys = offsets.T
1019 else:
1020 xs = []
1021 ys = []
1022 self._zdir = zdir
1023 self._offsets3d = juggle_axes(xs, ys, np.atleast_1d(zs), zdir)
1024 # In the base draw methods we access the attributes directly which
1025 # means we cannot resolve the shuffling in the getter methods like
1026 # we do for the edge and face colors.
1027 #
1028 # This means we need to carry around a cache of the unsorted sizes and
1029 # widths (postfixed with 3d) and in `do_3d_projection` set the
1030 # depth-sorted version of that data into the private state used by the
1031 # base collection class in its draw method.
1032 #
1033 # Grab the current sizes and linewidths to preserve them.
1034 self._sizes3d = self._sizes
1035 self._linewidths3d = np.array(self._linewidths)
1036 xs, ys, zs = self._offsets3d
1037
1038 # Sort the points based on z coordinates
1039 # Performance optimization: Create a sorted index array and reorder
1040 # points and point properties according to the index array
1041 self._z_markers_idx = slice(-1)
1042 self._vzs = None
1043
1044 self._axlim_clip = axlim_clip
1045 self.stale = True
1046
1047 def set_sizes(self, sizes, dpi=72.0):
1048 super().set_sizes(sizes, dpi)

Callers 1

__init__Method · 0.95

Calls 3

juggle_axesFunction · 0.85
update_scalarmappableMethod · 0.80
get_offsetsMethod · 0.80

Tested by

no test coverage detected