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

Skip to content

Commit 11d1b51

Browse files
committed
fix bug
well, the columns here should be rows, as we want to give different colors by row index. there is no problem in this example, because the matrix here is 5*5. But if the length of rows is bigger than that of columns, it will raise Exception, such as plt.bar(index, data[row], bar_width, bottom=y_offset, color=colors[row]) IndexError: index 2 is out of bounds for axis 0 with size 2
1 parent eb53398 commit 11d1b51

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

examples/pylab_examples/table_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
value_increment = 1000
1919

2020
# Get some pastel shades for the colors
21-
colors = plt.cm.BuPu(np.linspace(0, 0.5, len(columns)))
21+
colors = plt.cm.BuPu(np.linspace(0, 0.5, len(rows)))
2222
n_rows = len(data)
2323

2424
index = np.arange(len(columns)) + 0.3

0 commit comments

Comments
 (0)