【发布时间】:2021-06-08 15:50:44
【问题描述】:
这看起来很简单,但由于某种原因,我可以从表格中删除单元格边缘,或者用颜色填充表格单元格,但不能同时使用两者。我正在使用 v3.4.2。
import matplotlib.pyplot as plt
values = [[1,2,3],[4,5,6],[7,8,9]]
columns = ['Column 1', 'Column 2', 'Column 3']
colors = [['y','y','y'],['w','w','w'],['y','y','y']]
fig, ax = plt.subplots()
fig.patch.set_visible(False)
ax.axis('off')
ax.axis('tight')
table = ax.table(cellText=values,
colLabels=columns,
cellColours=colors,
edges='open',
loc='center')
plt.show()
使用上面的代码,表格边缘被成功隐藏,但单元格颜色没有出现。但是,如果我注释掉edges='open',则会出现单元格颜色,但当然表格边缘仍然存在。
我需要删除单元格边缘,并添加单元格填充。 任何帮助将不胜感激。
【问题讨论】:
标签: python matplotlib