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

Function get_dir_vector

lib/mpl_toolkits/mplot3d/art3d.py:41–72  ·  view source on GitHub ↗

Return a direction vector. Parameters ---------- zdir : {'x', 'y', 'z', None, 3-tuple} The direction. Possible values are: - 'x': equivalent to (1, 0, 0) - 'y': equivalent to (0, 1, 0) - 'z': equivalent to (0, 0, 1) - *None*: equivalent to (

(zdir)

Source from the content-addressed store, hash-verified

39
40
41def get_dir_vector(zdir):
42 """
43 Return a direction vector.
44
45 Parameters
46 ----------
47 zdir : {'x', 'y', 'z', None, 3-tuple}
48 The direction. Possible values are:
49
50 - 'x': equivalent to (1, 0, 0)
51 - 'y': equivalent to (0, 1, 0)
52 - 'z': equivalent to (0, 0, 1)
53 - *None*: equivalent to (0, 0, 0)
54 - an iterable (x, y, z) is converted to an array
55
56 Returns
57 -------
58 x, y, z : array
59 The direction vector.
60 """
61 if cbook._str_equal(zdir, 'x'):
62 return np.array((1, 0, 0))
63 elif cbook._str_equal(zdir, 'y'):
64 return np.array((0, 1, 0))
65 elif cbook._str_equal(zdir, 'z'):
66 return np.array((0, 0, 1))
67 elif zdir is None:
68 return np.array((0, 0, 0))
69 elif np.iterable(zdir) and len(zdir) == 3:
70 return np.array(zdir)
71 else:
72 raise ValueError("'x', 'y', 'z', None or vector of length 3 expected")
73
74
75def _viewlim_mask(xs, ys, zs, axes):

Callers 3

test_get_dir_vectorFunction · 0.90
set_position_3dMethod · 0.85
set_3d_propertiesMethod · 0.85

Calls

no outgoing calls

Tested by 1

test_get_dir_vectorFunction · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…