77from matplotlib .transforms import Bbox , TransformedBbox , Affine2D
88
99
10-
1110def adjust_bbox (fig , format , bbox_inches ):
1211 """
1312 Temporarily adjust the figure so that only the specified area
@@ -30,12 +29,11 @@ def adjust_bbox(fig, format, bbox_inches):
3029 locator_list .append (ax .get_axes_locator ())
3130 asp_list .append (ax .get_aspect ())
3231
33- def _l (a , r , pos = pos ): return pos
32+ def _l (a , r , pos = pos ):
33+ return pos
3434 ax .set_axes_locator (_l )
3535 ax .set_aspect ("auto" )
3636
37-
38-
3937 def restore_bbox ():
4038
4139 for ax , asp , loc in zip (fig .axes , asp_list , locator_list ):
@@ -53,7 +51,8 @@ def restore_bbox():
5351 adjust_bbox_handler (fig , bbox_inches )
5452 return restore_bbox
5553 else :
56- warnings .warn ("bbox_inches option for %s backend is not implemented yet." % (format ))
54+ warnings .warn ("bbox_inches option for %s backend is not "
55+ "implemented yet." % (format ))
5756 return None
5857
5958
@@ -79,8 +78,8 @@ def adjust_bbox_png(fig, bbox_inches):
7978
8079 fig .bbox = TransformedBbox (fig .bbox_inches , tr )
8180
82- fig .patch .set_bounds (x0 / w1 , y0 / h1 ,
83- fig .bbox .width / w1 , fig .bbox .height / h1 )
81+ fig .patch .set_bounds (x0 / w1 , y0 / h1 ,
82+ fig .bbox .width / w1 , fig .bbox .height / h1 )
8483
8584
8685def adjust_bbox_pdf (fig , bbox_inches ):
@@ -101,15 +100,15 @@ def adjust_bbox_pdf(fig, bbox_inches):
101100 bbox_inches .width ,
102101 bbox_inches .height )
103102 x0 , y0 = _bbox .x0 , _bbox .y0
104- w1 , h1 = fig .bbox .width * f , fig .bbox .height * f
103+ w1 , h1 = fig .bbox .width * f , fig .bbox .height * f
105104 fig .transFigure ._boxout = Bbox .from_bounds (- x0 , - y0 ,
106105 w1 , h1 )
107106 fig .transFigure .invalidate ()
108107
109108 fig .bbox = TransformedBbox (fig .bbox_inches , tr )
110109
111- fig .patch .set_bounds (x0 / w1 , y0 / h1 ,
112- fig .bbox .width / w1 , fig .bbox .height / h1 )
110+ fig .patch .set_bounds (x0 / w1 , y0 / h1 ,
111+ fig .bbox .width / w1 , fig .bbox .height / h1 )
113112
114113
115114def process_figure_for_rasterizing (figure ,
0 commit comments