I am using matplotlib to create a table with 5 rows and 4 columns. I would like to show the difference in values for all the entries in each individual column using color. Ideally, I would like to use a colormap scale which is individualized for each column, meaning that the scale for that column's colormap would have the range of that column's values.
To clarify - in the second column, values are between 800-1200, but the first column values are between 120-230. When the same colormap is applied on the entire table's range, the difference between values in the first column is much less defined than they would be if the colormap range was 120-230 instead of 120-1200.
This does not seem possible with matplotlib, as the colormap applies to the entire table. What I want could also just be a terrible and confusing presentation, so if there is a better way to show what I would like please let me know!
This is what I have now:
fig, ax = plt.subplots()
rows = ['%d nodes' % x for x in (10, 30, 50, 75, 100)]
columns=['TP', 'TN', 'FP', 'FN']
conf_data = np.array(
[[ 230, 847, 784, 208],
[ 156, 1240, 391, 282],
[ 146, 1212, 419, 292],
[ 130, 1148, 483, 308],
[ 122, 1173, 458, 316]]
)
normal = plt.Normalize(np.min(conf_data), np.max(conf_data))
fig.patch.set_visible(False)
ax.axis('off')
ax.axis('tight')
ax.table(cellText=conf_data,
rowLabels=rows,
colLabels=columns,
cellColours=cm.GnBu(normal(conf_data)),
loc='center',
colWidths=[0.1 for x in columns])
fig.tight_layout()
plt.show()