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

Skip to content

Commit 640d05f

Browse files
committed
DOC/ENH : get/set_size_inches
Added links between `get_size_inches` and `set_size_inches` Added an `np.array` call to `get_size_inches` to return a copy of the size, instead of a reference to the internal np.array. Closes matplotlib#2303
1 parent 2617d05 commit 640d05f

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

lib/matplotlib/figure.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,8 @@ 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+
.. seealso:: :func:`~matplotlib.Figure.get_size_inches`
638640
"""
639641

640642
forward = kwargs.get('forward', False)
@@ -655,7 +657,17 @@ def set_size_inches(self, *args, **kwargs):
655657
manager.resize(int(canvasw), int(canvash))
656658

657659
def get_size_inches(self):
658-
return self.bbox_inches.p1
660+
"""
661+
Returns the current size of the figure in inches as an numpy array.
662+
663+
Returns
664+
-------
665+
size : ndarray
666+
The size of the figure in inches
667+
668+
.. seealso:: :func:`~matplotlib.Figure.set_size_inches`
669+
"""
670+
return np.array(self.bbox_inches.p1)
659671

660672
def get_edgecolor(self):
661673
'Get the edge color of the Figure rectangle'

0 commit comments

Comments
 (0)