Python 實現圖片上表格的寫入


直接上代碼:
import matplotlib.pylab as plt
import numpy as np
plt.figure()
axes=plt.gca()
y= np.random.randn(9)
col_labels=['col1','col2','col3']
row_labels=['row1','row2','row3']
table_vals=[[11,12,13],[21,22,23],[28,29,30]]
row_colors=['red','gold','green']
col_colors=['blue','gold','green']
the_table = plt.table(cellText=table_vals,
colWidths = [0.1]*3,
rowLabels=row_labels,
colLabels=col_labels,
rowColours=row_colors,
colColours=col_colors,
loc='upper right')
plt.text(12,3.4,'Table Title',size=8)
plt.plot(y)
plt.show()
運行結果如下:

 

 
         
         
       


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM