@@ -183,18 +183,28 @@ def _get_coord_info(self, renderer):
183
183
self .axes .get_ybound (),
184
184
self .axes .get_zbound (),
185
185
]).T
186
- centers = (maxs + mins ) / 2.
187
- deltas = (maxs - mins ) / 12.
188
- mins = mins - deltas / 4.
189
- maxs = maxs + deltas / 4.
190
-
191
- vals = mins [0 ], maxs [0 ], mins [1 ], maxs [1 ], mins [2 ], maxs [2 ]
192
- tc = self .axes .tunit_cube (vals , self .axes .M )
193
- avgz = [tc [p1 ][2 ] + tc [p2 ][2 ] + tc [p3 ][2 ] + tc [p4 ][2 ]
194
- for p1 , p2 , p3 , p4 in self ._PLANES ]
195
- highs = np .array ([avgz [2 * i ] < avgz [2 * i + 1 ] for i in range (3 )])
196
-
197
- return mins , maxs , centers , deltas , tc , highs
186
+
187
+ # Get the mean value for each bound:
188
+ centers = 0.5 * (maxs + mins )
189
+
190
+ # Add a small offset between min/max point and the edge of the
191
+ # plot:
192
+ deltas = (maxs - mins ) / 12
193
+ mins -= 0.25 * deltas
194
+ maxs += 0.25 * deltas
195
+
196
+ # Project the bounds along the current position of the cube:
197
+ bounds = mins [0 ], maxs [0 ], mins [1 ], maxs [1 ], mins [2 ], maxs [2 ]
198
+ bounds_proj = self .axes .tunit_cube (bounds , self .axes .M )
199
+
200
+ # Determine which one of the parallel planes are higher up:
201
+ highs = np .zeros (3 , dtype = bool )
202
+ for i in range (3 ):
203
+ mean_z0 = np .mean (bounds_proj [self ._PLANES [2 * i ], 2 ])
204
+ mean_z1 = np .mean (bounds_proj [self ._PLANES [2 * i + 1 ], 2 ])
205
+ highs [i ] = mean_z0 < mean_z1
206
+
207
+ return mins , maxs , centers , deltas , bounds_proj , highs
198
208
199
209
def draw_pane (self , renderer ):
200
210
renderer .open_group ('pane3d' , gid = self .get_gid ())
0 commit comments