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

Method _zoom_data_limits

lib/mpl_toolkits/mplot3d/axes3d.py:1959–1995  ·  view source on GitHub ↗

Zoom in or out of a 3D plot. Will scale the data limits by the scale factors. These will be transformed to the x, y, z data axes based on the current view angles. A scale factor > 1 zooms out and a scale factor < 1 zooms in. For an Axes that has had its asp

(self, scale_u, scale_v, scale_w)

Source from the content-addressed store, hash-verified

1957 self._zoom_data_limits(scale, scale, scale)
1958
1959 def _zoom_data_limits(self, scale_u, scale_v, scale_w):
1960 """
1961 Zoom in or out of a 3D plot.
1962
1963 Will scale the data limits by the scale factors. These will be
1964 transformed to the x, y, z data axes based on the current view angles.
1965 A scale factor > 1 zooms out and a scale factor < 1 zooms in.
1966
1967 For an Axes that has had its aspect ratio set to 'equal', 'equalxy',
1968 'equalyz', or 'equalxz', the relevant axes are constrained to zoom
1969 equally.
1970
1971 Parameters
1972 ----------
1973 scale_u : float
1974 Scale factor for the u view axis (view screen horizontal).
1975 scale_v : float
1976 Scale factor for the v view axis (view screen vertical).
1977 scale_w : float
1978 Scale factor for the w view axis (view screen depth).
1979 """
1980 scale = np.array([scale_u, scale_v, scale_w])
1981
1982 # Only perform frame conversion if unequal scale factors
1983 if not np.allclose(scale, scale_u):
1984 # Convert the scale factors from the view frame to the data frame
1985 R = np.array([self._view_u, self._view_v, self._view_w])
1986 S = scale * np.eye(3)
1987 scale = np.linalg.norm(R.T @ S, axis=1)
1988
1989 # Set the constrained scale factors to the factor closest to 1
1990 if self._aspect in ('equal', 'equalxy', 'equalxz', 'equalyz'):
1991 ax_idxs = self._equal_aspect_axis_indices(self._aspect)
1992 min_ax_idxs = np.argmin(np.abs(scale[ax_idxs] - 1))
1993 scale[ax_idxs] = scale[ax_idxs][min_ax_idxs]
1994
1995 self._scale_axis_limits(scale[0], scale[1], scale[2])
1996
1997 def _scale_axis_limits(self, scale_x, scale_y, scale_z):
1998 """

Callers 1

_set_view_from_bboxMethod · 0.95

Calls 4

_scale_axis_limitsMethod · 0.95
allcloseMethod · 0.80
normMethod · 0.45

Tested by

no test coverage detected