@@ -684,3 +684,30 @@ def test_imagegrid():
684
684
im = ax .imshow ([[1 , 2 ]], norm = mpl .colors .LogNorm ())
685
685
cb = ax .cax .colorbar (im )
686
686
assert isinstance (cb .locator , mticker .LogLocator )
687
+
688
+
689
+ @image_comparison (['anchored_locator_base_call.png' ],style = 'classic' )
690
+ def test_anchored_locator_base_call ():
691
+ fig = plt .figure (figsize = (3 ,3 ))
692
+ fig1 , fig2 = fig .subfigures (nrows = 2 , ncols = 1 , height_ratios = [1 , 1 ], squeeze = True )
693
+
694
+ ax = fig1 .subplots ()
695
+ ax .set (aspect = 1 , xlim = (- 15 , 15 ), ylim = (- 20 , 5 ))
696
+
697
+ Z = cbook .get_sample_data ("axes_grid/bivariate_normal.npy" , np_load = True )
698
+ extent = (- 3 , 4 , - 4 , 3 )
699
+
700
+ axins = zoomed_inset_axes (ax , zoom = 2 , loc = 'upper left' )
701
+ axins .set (xticks = [], yticks = [])
702
+ im = axins .imshow (Z , extent = extent , origin = "lower" )
703
+
704
+ # colorbar
705
+ cax = inset_axes (axins ,
706
+ width = "5%" , # width = 10% of parent_bbox width
707
+ height = "100%" , # height : 50%
708
+ loc = 'lower left' ,
709
+ bbox_to_anchor = (1.05 , 0. , 1 , 1 ),
710
+ bbox_transform = axins .transAxes ,
711
+ borderpad = 0 ,
712
+ )
713
+ fig .colorbar (im , cax = cax )
0 commit comments