@@ -1640,10 +1640,10 @@ def colorbar(
16401640 # Fill this axes
16411641 if cax is not None :
16421642 with context ._state_context (cax , _internal_call = True ): # do not wrap pcolor
1643- return super ().colorbar (mappable , cax = cax , ** kwargs )
1643+ cb = super ().colorbar (mappable , cax = cax , ** kwargs )
16441644 # Axes panel colorbar
16451645 elif ax is not None :
1646- return ax .colorbar (
1646+ cb = ax .colorbar (
16471647 mappable , values , space = space , pad = pad , width = width , ** kwargs
16481648 )
16491649 # Figure panel colorbar
@@ -1653,7 +1653,8 @@ def colorbar(
16531653 loc , row = row , col = col , rows = rows , cols = cols , span = span ,
16541654 width = width , space = space , pad = pad ,
16551655 )
1656- return ax .colorbar (mappable , values , loc = 'fill' , ** kwargs )
1656+ cb = ax .colorbar (mappable , values , loc = 'fill' , ** kwargs )
1657+ return cb
16571658
16581659 @docstring ._concatenate_inherited
16591660 @docstring ._snippet_manager
@@ -1686,7 +1687,7 @@ def legend(
16861687 ax = kwargs .pop ('ax' , None )
16871688 # Axes panel legend
16881689 if ax is not None :
1689- return ax .legend (
1690+ leg = ax .legend (
16901691 handles , labels , space = space , pad = pad , width = width , ** kwargs
16911692 )
16921693 # Figure panel legend
@@ -1696,7 +1697,8 @@ def legend(
16961697 loc , row = row , col = col , rows = rows , cols = cols , span = span ,
16971698 width = width , space = space , pad = pad ,
16981699 )
1699- return ax .legend (handles , labels , loc = 'fill' , ** kwargs )
1700+ leg = ax .legend (handles , labels , loc = 'fill' , ** kwargs )
1701+ return leg
17001702
17011703 @docstring ._snippet_manager
17021704 def save (self , filename , ** kwargs ):
0 commit comments