@@ -659,7 +659,7 @@ def figimage(self, X,
659659 self .stale = True
660660 return im
661661
662- def set_size_inches (self , * args , ** kwargs ):
662+ def set_size_inches (self , w , h = None , forward = False ):
663663 """
664664 set_size_inches(w,h, forward=False)
665665
@@ -682,11 +682,10 @@ def set_size_inches(self, *args, **kwargs):
682682 matplotlib.Figure.get_size_inches
683683 """
684684
685- forward = kwargs .get ('forward' , False )
686- if len (args ) == 1 :
687- w , h = args [0 ]
688- else :
689- w , h = args
685+ # the width and height have been passed in as a tuple to the first
686+ # argument, so unpack them
687+ if h is None :
688+ w , h = w
690689
691690 dpival = self .dpi
692691 self .bbox_inches .p1 = w , h
@@ -766,23 +765,21 @@ def set_dpi(self, val):
766765 self .dpi = val
767766 self .stale = True
768767
769- def set_figwidth (self , val ):
768+ def set_figwidth (self , val , forward = False ):
770769 """
771770 Set the width of the figure in inches
772771
773772 ACCEPTS: float
774773 """
775- self .bbox_inches .x1 = val
776- self .stale = True
774+ self .set_size_inches (val , self .get_figheight (), forward = forward )
777775
778- def set_figheight (self , val ):
776+ def set_figheight (self , val , forward = False ):
779777 """
780778 Set the height of the figure in inches
781779
782780 ACCEPTS: float
783781 """
784- self .bbox_inches .y1 = val
785- self .stale = True
782+ self .set_size_inches (self .get_figwidth (), val , forward = forward )
786783
787784 def set_frameon (self , b ):
788785 """
0 commit comments