Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 99d5012

Browse files
committed
Merge pull request #2836 from tacaswell/set_size_doc
DOC/ENH : get/set_size_inches
2 parents 7feeb0e + 08b68c2 commit 99d5012

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

lib/matplotlib/figure.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ def set_size_inches(self, *args, **kwargs):
623623
"""
624624
set_size_inches(w,h, forward=False)
625625
626-
Set the figure size in inches
626+
Set the figure size in inches (1in == 2.54cm)
627627
628628
Usage::
629629
@@ -635,6 +635,11 @@ def set_size_inches(self, *args, **kwargs):
635635
from the shell
636636
637637
ACCEPTS: a w,h tuple with w,h in inches
638+
639+
See Also
640+
--------
641+
642+
:func:`~matplotlib.Figure.get_size_inches`
638643
"""
639644

640645
forward = kwargs.get('forward', False)
@@ -655,7 +660,21 @@ def set_size_inches(self, *args, **kwargs):
655660
manager.resize(int(canvasw), int(canvash))
656661

657662
def get_size_inches(self):
658-
return self.bbox_inches.p1
663+
"""
664+
Returns the current size of the figure in inches (1in == 2.54cm)
665+
as an numpy array.
666+
667+
Returns
668+
-------
669+
size : ndarray
670+
The size of the figure in inches
671+
672+
See Also
673+
--------
674+
675+
:func:`~matplotlib.Figure.set_size_inches`
676+
"""
677+
return np.array(self.bbox_inches.p1)
659678

660679
def get_edgecolor(self):
661680
'Get the edge color of the Figure rectangle'

0 commit comments

Comments
 (0)