44================
55
66"""
7- from matplotlib .transforms import Bbox , TransformedBbox , \
8- blended_transform_factory
7+ from matplotlib .transforms import (
8+ Bbox , TransformedBbox , blended_transform_factory )
99
10- from mpl_toolkits .axes_grid1 .inset_locator import BboxPatch , BboxConnector ,\
11- BboxConnectorPatch
10+ from mpl_toolkits .axes_grid1 .inset_locator import (
11+ BboxPatch , BboxConnector , BboxConnectorPatch )
1212
1313
1414def connect_bbox (bbox1 , bbox2 ,
1515 loc1a , loc2a , loc1b , loc2b ,
1616 prop_lines , prop_patches = None ):
1717 if prop_patches is None :
18- prop_patches = prop_lines .copy ()
19- prop_patches ["alpha" ] = prop_patches .get ("alpha" , 1 ) * 0.2
18+ prop_patches = {
19+ ** prop_lines ,
20+ "alpha" : prop_lines .get ("alpha" , 1 ) * 0.2 ,
21+ }
2022
2123 c1 = BboxConnector (bbox1 , bbox2 , loc1 = loc1a , loc2 = loc2a , ** prop_lines )
2224 c1 .set_clip_on (False )
@@ -55,14 +57,12 @@ def zoom_effect01(ax1, ax2, xmin, xmax, **kwargs):
5557 mybbox1 = TransformedBbox (bbox , trans1 )
5658 mybbox2 = TransformedBbox (bbox , trans2 )
5759
58- prop_patches = kwargs .copy ()
59- prop_patches ["ec" ] = "none"
60- prop_patches ["alpha" ] = 0.2
60+ prop_patches = {** kwargs , "ec" : "none" , "alpha" : 0.2 }
6161
62- c1 , c2 , bbox_patch1 , bbox_patch2 , p = \
63- connect_bbox ( mybbox1 , mybbox2 ,
64- loc1a = 3 , loc2a = 2 , loc1b = 4 , loc2b = 1 ,
65- prop_lines = kwargs , prop_patches = prop_patches )
62+ c1 , c2 , bbox_patch1 , bbox_patch2 , p = connect_bbox (
63+ mybbox1 , mybbox2 ,
64+ loc1a = 3 , loc2a = 2 , loc1b = 4 , loc2b = 1 ,
65+ prop_lines = kwargs , prop_patches = prop_patches )
6666
6767 ax1 .add_patch (bbox_patch1 )
6868 ax2 .add_patch (bbox_patch2 )
@@ -88,14 +88,12 @@ def zoom_effect02(ax1, ax2, **kwargs):
8888 <
CE1B
span class=pl-s1>mybbox1 = ax1 .bbox
8989 mybbox2 = TransformedBbox (ax1 .viewLim , trans )
9090
91- prop_patches = kwargs .copy ()
92- prop_patches ["ec" ] = "none"
93- prop_patches ["alpha" ] = 0.2
91+ prop_patches = {** kwargs , "ec" : "none" , "alpha" : 0.2 }
9492
95- c1 , c2 , bbox_patch1 , bbox_patch2 , p = \
96- connect_bbox ( mybbox1 , mybbox2 ,
97- loc1a = 3 , loc2a = 2 , loc1b = 4 , loc2b = 1 ,
98- prop_lines = kwargs , prop_patches = prop_patches )
93+ c1 , c2 , bbox_patch1 , bbox_patch2 , p = connect_bbox (
94+ mybbox1 , mybbox2 ,
95+ loc1a = 3 , loc2a = 2 , loc1b = 4 , loc2b = 1 ,
96+ prop_lines = kwargs , prop_patches = prop_patches )
9997
10098 ax1 .add_patch (bbox_patch1 )
10199 ax2 .add_patch (bbox_patch2 )
0 commit comments