@@ -872,9 +872,9 @@ def get_proj(self):
872
872
873
873
# Calculate the viewing axes for the eye position
874
874
u , v , n = self ._calc_view_axes (eye )
875
- self ._view_u = u
876
- self ._view_v = v
877
- self ._view_n = n
875
+ self ._view_u = u # _view_u is towards the right of the screen
876
+ self ._view_v = v # _view_v is towards the top of the screen
877
+ self ._view_n = n # _view_n is out of the screen
878
878
879
879
# Generate the view and projection transformation matrices
880
880
if self ._focal_length == np .inf :
@@ -1137,7 +1137,7 @@ def drag_pan(self, button, key, x, y):
1137
1137
1138
1138
def _calc_view_axes (self , eye ):
1139
1139
"""
1140
- Get the unit viewing axes in data coordinates.
1140
+ Get the unit vectors for the viewing axes in data coordinates.
1141
1141
`u` is towards the right of the screen
1142
1142
`v` is towards the top of the screen
1143
1143
`n` is out of the screen
@@ -1186,31 +1186,32 @@ def _set_view_from_bbox(self, bbox, direction='in',
1186
1186
# Calculate zoom level
1187
1187
dx = abs (start_x - stop_x )
1188
1188
dy = abs (start_y - stop_y )
1189
- scale_x = dx / (self .bbox .max [0 ] - self .bbox .min [0 ])
1190
- scale_y = dy / (self .bbox .max [1 ] - self .bbox .min [1 ])
1191
- scale_z = 1
1189
+ scale_u = dx / (self .bbox .max [0 ] - self .bbox .min [0 ])
1190
+ scale_v = dy / (self .bbox .max [1 ] - self .bbox .min [1 ])
1191
+ scale_n = 1
1192
1192
1193
1193
# Limit box zoom to reasonable range, protect for divide by zero below
1194
- scale_x = np .clip (scale_x , 1e-2 , 1e2 )
1195
- scale_y = np .clip (scale_y , 1e-2 , 1e2 )
1194
+ scale_u = np .clip (scale_u , 1e-2 , 1e2 )
1195
+ scale_v = np .clip (scale_v , 1e-2 , 1e2 )
1196
1196
1197
1197
if direction == 'out' :
1198
- scale_x = 1 / scale_x
1199
- scale_y = 1 / scale_y
1198
+ scale_u = 1 / scale_u
1199
+ scale_v = 1 / scale_v
1200
1200
1201
- self ._zoom_data_limits (scale_x , scale_y , scale_z )
1201
+ self ._zoom_data_limits (scale_u , scale_v , scale_v )
1202
1202
1203
- def _zoom_data_limits (self , scale_x , scale_y , scale_z ):
1203
+ def _zoom_data_limits (self , scale_u , scale_v , scale_n ):
1204
1204
"""
1205
1205
Zoom in or out of a 3D plot.
1206
- Will scale the data limits by the scale factors, where scale_x,
1207
- scale_y, and scale_z refer to the scale factors for the viewing axes.
1208
- These will be transformed to the data axes based on the current view
1209
- angles. A scale factor > 1 zooms out and a scale factor < 1 zooms in.
1206
+ Will scale the data limits by the scale factors, where scale_u,
1207
+ scale_v, and scale_n refer to the scale factors for the viewing axes.
1208
+ These will be transformed to the x, y, z data axes based on the current
1209
+ view angles. A scale factor > 1 zooms out and a scale factor < 1 zooms
1210
+ in.
1210
1211
"""
1211
1212
# Convert from the scale factors in the view frame to the data frame
1212
1213
R = np .array ([self ._view_u , self ._view_v , self ._view_n ])
1213
- S = np .array ([scale_x , scale_y , scale_z ])
1214
+ S = np .array ([scale_u , scale_v , scale_n ])
1214
1215
scale = np .linalg .norm (R .T @(np .eye (3 )* S ), axis = 1 )
1215
1216
1216
1217
# Scale the data range
@@ -1376,7 +1377,7 @@ def plot(self, xs, ys, *args, zdir='z', **kwargs):
1376
1377
z coordinates of vertices; either one for all points or one for
1377
1378
each point.
1378
1379
zdir : {'x', 'y', 'z'}, default: 'z'
1379
- When plotting 3D data, the direction to use as z ('x', 'y' or 'z').
1380
+ When plotting 2D data, the direction to use as z ('x', 'y' or 'z').
1380
1381
**kwargs
1381
1382
Other arguments are forwarded to `matplotlib.axes.Axes.plot`.
1382
1383
"""
0 commit comments