Skip to content

Commit d874f13

Browse files
committed
FIX: jumping axes
The first time the Axes3D is drawn the x,y,z axis are drawn before the aspect has been adjusted so they are wrong (the double zaxis the previous commit removed was actually the correct one). This copies the relevant code up to the Axes3D level. This is not great as there is code-duplication, but the 'correct' solution is to make the Axes.draw method much more pluggable which is a very large job.
1 parent fd98f28 commit d874f13

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/mpl_toolkits/mplot3d/axes3d.py

+12
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,18 @@ def draw(self, renderer):
247247
self.axesPatch.draw(renderer)
248248
self._frameon = False
249249

250+
# first, set the aspect
251+
# this is duplicated from `axes._base._AxesBase.draw`
252+
# but must be called before any of the artist are drawn as
253+
# it adjusts the view limits and the size of the bounding box
254+
# of the axes
255+
locator = self.get_axes_locator()
256+
if locator:
257+
pos = locator(self, renderer)
258+
self.apply_aspect(pos)
259+
else:
260+
self.apply_aspect()
261+
250262
# add the projection matrix to the renderer
251263
self.M = self.get_proj()
252264
renderer.M = self.M

0 commit comments

Comments
 (0)