Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9d5fc37

Browse filesBrowse files
authored
Merge pull request #11492 from timhoffm/gridpsec-repr
add __repr__ to GridSpecBase
2 parents 9014698 + 6cde4bf commit 9d5fc37
Copy full SHA for 9d5fc37

File tree

Expand file treeCollapse file tree

1 file changed

+12
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+12
-0
lines changed

‎lib/matplotlib/gridspec.py

Copy file name to clipboardExpand all lines: lib/matplotlib/gridspec.py
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,18 @@ def __init__(self, nrows, ncols, height_ratios=None, width_ratios=None):
4444
self.set_height_ratios(height_ratios)
4545
self.set_width_ratios(width_ratios)
4646

47+
def __repr__(self):
48+
height_arg = (', height_ratios=%r' % self._row_height_ratios
49+
if self._row_height_ratios is not None else '')
50+
width_arg = (', width_ratios=%r' % self._col_width_ratios
51+
if self._col_width_ratios is not None else '')
52+
return '{clsname}({nrows}, {ncols}{optionals})'.format(
53+
clsname=self.__class__.__name__,
54+
nrows=self._nrows,
55+
ncols=self._ncols,
56+
optionals=height_arg + width_arg,
57+
)
58+
4759
def get_geometry(self):
4860
'get the geometry of the grid, e.g., 2,3'
4961
return self._nrows, self._ncols

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.