给出下表:
import matplotlib.pyplot as plt
table=plt.table(cellText=[' ', ' ', ' ', ' ', ' '], # rows of data values
rowLabels=['1','2','3','4','5'],
cellLoc="left",
rowLoc='left',
bbox=[0,0,.2,1], # [left,bottom,width,height]
edges="")
我想把数字(1-5)的颜色改成灰色,把字号改成12号。在
您需要获取单元格的文本字体属性:
另一种获取单元格文本属性的方法是使用单元格索引(i,j):
^{pr2}$Matplotlib文本字体属性如下所述:http://matplotlib.org/api/text_api.html#matplotlib.text.Text.set_fontproperties
因此,第一个代码绘制了这个图:
相关问题 更多 >
编程相关推荐