Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
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
  • Loading branch information
xuanyuansen committed Aug 28, 2015
1 parent eb53398 commit 11d1b51
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion examples/pylab_examples/table_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
value_increment = 1000

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

index = np.arange(len(columns)) + 0.3
Expand Down

0 comments on commit 11d1b51

Please sign in to comment.