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 7c2057b

Browse filesBrowse files
authored
Merge pull request #17131 from lpsinger/fix-gridspec-format-error
BUG: Fix formatting error in GridSpec.__repr__
2 parents f6b8891 + a8351b9 commit 7c2057b
Copy full SHA for 7c2057b

File tree

Expand file treeCollapse file tree

2 files changed

+8
-2
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+8
-2
lines changed

‎lib/matplotlib/gridspec.py

Copy file name to clipboardExpand all lines: lib/matplotlib/gridspec.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ def __init__(self, nrows, ncols, height_ratios=None, width_ratios=None):
4848
self.set_width_ratios(width_ratios)
4949

5050
def __repr__(self):
51-
height_arg = (', height_ratios=%r' % self._row_height_ratios
51+
height_arg = (', height_ratios=%r' % (self._row_height_ratios,)
5252
if self._row_height_ratios is not None else '')
53-
width_arg = (', width_ratios=%r' % self._col_width_ratios
53+
width_arg = (', width_ratios=%r' % (self._col_width_ratios,)
5454
if self._col_width_ratios is not None else '')
5555
return '{clsname}({nrows}, {ncols}{optionals})'.format(
5656
clsname=self.__class__.__name__,

‎lib/matplotlib/tests/test_gridspec.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_gridspec.py
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,9 @@ def test_height_ratios():
2929
def test_repr():
3030
ss = gridspec.GridSpec(3, 3)[2, 1:3]
3131
assert repr(ss) == "GridSpec(3, 3)[2:3, 1:3]"
32+
33+
ss = gridspec.GridSpec(2, 2,
34+
height_ratios=(3, 1),
35+
width_ratios=(1, 3))
36+
assert repr(ss) == \
37+
"GridSpec(2, 2, height_ratios=(3, 1), width_ratios=(1, 3))"

0 commit comments

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