Skip to content

Commit 5546552

Browse files
committed
Merge pull request #7520 from dstansby/table-bug
Fix table.py bug
1 parent 3972533 commit 5546552

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

lib/matplotlib/table.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ def table(ax,
558558
# assume just colours are needed
559559
rows = len(cellColours)
560560
cols = len(cellColours[0])
561-
cellText = [[''] * rows] * cols
561+
cellText = [[''] * cols] * rows
562562

563563
rows = len(cellText)
564564
cols = len(cellText[0])

lib/matplotlib/tests/test_table.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,20 @@
55

66
import matplotlib.pyplot as plt
77
import numpy as np
8-
from matplotlib.testing.decorators import image_comparison
8+
from matplotlib.testing.decorators import image_comparison, cleanup
99

1010
from matplotlib.table import CustomCell
1111
from matplotlib.path import Path
1212
from nose.tools import assert_equal
1313

1414

15+
@cleanup
16+
def test_non_square():
17+
# Check that creating a non-square table works
18+
cellcolors = ['b', 'r']
19+
plt.table(cellColours=cellcolors)
20+
21+
1522
@image_comparison(baseline_images=['table_zorder'],
1623
extensions=['png'],
1724
remove_text=True)

0 commit comments

Comments
 (0)