@@ -231,11 +231,34 @@ def _get_coord_info(self, renderer):
231
231
bounds_proj = self .axes .tunit_cube (bounds , self .axes .M )
232
232
233
233
# Determine which one of the parallel planes are higher up:
234
- highs = np .zeros (3 , dtype = bool )
234
+ means_z0 = np .zeros (3 )
235
+ means_z1 = np .zeros (3 )
235
236
for i in range (3 ):
236
- mean_z0 = np .mean (bounds_proj [self ._PLANES [2 * i ], 2 ])
237
- mean_z1 = np .mean (bounds_proj [self ._PLANES [2 * i + 1 ], 2 ])
238
- highs [i ] = mean_z0 < mean_z1
237
+ means_z0 [i ] = np .mean (bounds_proj [self ._PLANES [2 * i ], 2 ])
238
+ means_z1 [i ] = np .mean (bounds_proj [self ._PLANES [2 * i + 1 ], 2 ])
239
+ highs = means_z0 < means_z1
240
+
241
+ # Special handling for edge-on views
242
+ equals = np .abs (means_z0 - means_z1 ) <= np .finfo (float ).eps
243
+ if np .sum (equals ) == 2 :
244
+ vertical = np .where (np .invert (equals ))[0 ][0 ]
245
+ if vertical == 2 :
246
+ if highs [2 ]: # looking at -XY plane
247
+ highs [0 ] = False
248
+ highs [1 ] = True
249
+ else : # looking at +XY plane
250
+ highs [0 ] = True
251
+ highs [1 ] = True
252
+ elif vertical == 1 :
253
+ if highs [1 ]: # looking at +XZ plane
254
+ highs [0 ] = True
255
+ else : # looking at -XZ plane
256
+ pass
257
+ elif vertical == 0 :
258
+ if highs [0 ]: # looking at -YZ plane
259
+ highs [1 ] = True
260
+ else : # looking at +YZ plane
261
+ pass
239
262
240
263
return mins , maxs , centers , deltas , bounds_proj , highs
241
264
0 commit comments