@@ -255,6 +255,20 @@ def tunit_edges(self, vals=None, M=None):
255255 (tc [7 ], tc [4 ])]
256256 return edges
257257
258+ def apply_aspect (self , position = None ):
259+ if position is None :
260+ position = self .get_position (original = True )
261+
262+ # in the superclass, we would go through and actually deal with axis
263+ # scales and box/datalim. Those are all irrelevant - all we need to do
264+ # is make sure our coordinate system is square.
265+ figW , figH = self .get_figure ().get_size_inches ()
266+ fig_aspect = figH / figW
267+ box_aspect = 1
268+ pb = position .frozen ()
269+ pb1 = pb .shrunk_to_aspect (box_aspect , pb , fig_aspect )
270+ self .set_position (pb1 .anchored (self .get_anchor (), pb ), 'active' )
271+
258272 @artist .allow_rasterization
259273 def draw (self , renderer ):
260274 # draw the background patch
@@ -950,6 +964,9 @@ def get_proj(self):
950964
951965 dist is the distance of the eye viewing point from the object point.
952966 """
967+ # chosen for similarity with the initial view before gh-8896
968+ pb_aspect = np .array ([4 , 4 , 3 ]) / 3.5
969+
953970 relev , razim = np .pi * self .elev / 180 , np .pi * self .azim / 180
954971
955972 xmin , xmax = self .get_xlim3d ()
@@ -959,10 +976,10 @@ def get_proj(self):
959976 # transform to uniform world coordinates 0-1, 0-1, 0-1
960977 worldM = proj3d .world_transformation (xmin , xmax ,
961978 ymin , ymax ,
962- zmin , zmax )
979+ zmin , zmax , pb_aspect = pb_aspect )
963980
964981 # look into the middle of the new coordinates
965- R = np . array ([ 0.5 , 0.5 , 0.5 ])
982+ R = pb_aspect / 2
966983
967984 xp = R [0 ] + np .cos (razim ) * np .cos (relev ) * self .dist
968985 yp = R [1 ] + np .sin (razim ) * np .cos (relev ) * self .dist
0 commit comments