2
继pylab_examples,我在matplotlib创建了一个简单的2×细胞表。如何分配在Matplotlib表特定颜色的特定细胞?
代码:
# Prepare table
columns = ('A', 'B', 'C', 'D', 'E')
rows = ["A", "B"]
cell_text = [["1", "1","1","1","1"], ["2","2","2","2","2"]]
# Add a table at the bottom of the axes
ax[4].axis('tight')
ax[4].axis('off')
the_table = ax[4].table(cellText=cell_text,colLabels=columns,loc='center')
现在,我要的颜色单元格A1与color = "#56b5fd"
和单元格A2与color = "#1ac3f5"
。所有其他细胞应保持白色。 Matplotlib的table_demo.py以及this例如只告诉我如何应用彩色地图依赖于细胞中的值预先定义的颜色。
如何分配在Matplotlib生成表的具体颜色以特定细胞?