Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bc8593d

Browse files
committed
BUG: Fix gh-8894, by always using a square position
1 parent c0cd944 commit bc8593d

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,20 @@ def tunit_edges(self, vals=None, M=None):
247247
(tc[7], tc[4])]
248248
return edges
249249

250+
def apply_aspect(self, position=None):
251+
if position is None:
252+
position = self.get_position(original=True)
253+
254+
# in the superclass, we would go through and actually deal with axis
255+
# scales and box/datalim. Those are all irrelevant - all we need to do
256+
# is make sure our coordinate system is square.
257+
figW, figH = self.get_figure().get_size_inches()
258+
fig_aspect = figH / figW
259+
box_aspect = 1
260+
pb = position.frozen()
261+
pb1 = pb.shrunk_to_aspect(box_aspect, pb, fig_aspect)
262+
self.set_position(pb1.anchored(self.get_anchor(), pb), 'active')
263+
250264
def draw(self, renderer):
251265
# draw the background patch
252266
self.patch.draw(renderer)

0 commit comments

Comments
 (0)