Fix table.py bug #7520

Merged
merged 2 commits into from Nov 27, 2016
View
@@ -586,7 +586,7 @@ def table(ax,
# assume just colours are needed
rows = len(cellColours)
cols = len(cellColours[0])
- cellText = [[''] * rows] * cols
+ cellText = [[''] * cols] * rows
rows = len(cellText)
cols = len(cellText[0])
@@ -5,13 +5,20 @@
import matplotlib.pyplot as plt
import numpy as np
-from matplotlib.testing.decorators import image_comparison
+from matplotlib.testing.decorators import image_comparison, cleanup
from matplotlib.table import CustomCell
from matplotlib.path import Path
from nose.tools import assert_equal
+@cleanup
+def test_non_square():
+ # Check that creating a non-square table works
+ cellcolors = ['b', 'r']
+ plt.table(cellColours=cellcolors)
+
+
@image_comparison(baseline_images=['table_zorder'],
extensions=['png'],
remove_text=True)