7
7
from matplotlib .transforms import Bbox , TransformedBbox , Affine2D
8
8
9
9
10
-
11
10
def adjust_bbox (fig , format , bbox_inches ):
12
11
"""
13
12
Temporarily adjust the figure so that only the specified area
@@ -30,12 +29,11 @@ def adjust_bbox(fig, format, bbox_inches):
30
29
locator_list .append (ax .get_axes_locator ())
31
30
asp_list .append (ax .get_aspect ())
32
31
33
- def _l (a , r , pos = pos ): return pos
32
+ def _l (a , r , pos = pos ):
33
+ return pos
34
34
ax .set_axes_locator (_l )
35
35
ax .set_aspect ("auto" )
36
36
37
-
38
-
39
37
def restore_bbox ():
40
38
41
39
for ax , asp , loc in zip (fig .axes , asp_list , locator_list ):
@@ -53,7 +51,8 @@ def restore_bbox():
53
51
adjust_bbox_handler (fig , bbox_inches )
54
52
return restore_bbox
55
53
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 ))
57
56
return None
58
57
59
58
@@ -79,8 +78,8 @@ def adjust_bbox_png(fig, bbox_inches):
79
78
80
79
fig .bbox = TransformedBbox (fig .bbox_inches , tr )
81
80
8000
tr>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 )
84
83
85
84
86
85
def adjust_bbox_pdf (fig , bbox_inches ):
@@ -101,15 +100,15 @@ def adjust_bbox_pdf(fig, bbox_inches):
101
100
bbox_inches .width ,
102
101
bbox_inches .height )
103
102
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
105
104
fig .transFigure ._boxout = Bbox .from_bounds (- x0 , - y0 ,
106
105
w1 , h1 )
107
106
fig .transFigure .invalidate ()
108
107
109
108
fig .bbox = TransformedBbox (fig .bbox_inches , tr )
110
109
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 )
113
112
114
113
115
114
def process_figure_for_rasterizing (figure ,
0 commit comments