如何增加 table 的大小?
How can I increase the size of the table?
我试图将 pandas 数据帧显示为图像,但是当我使用 plt.show() 时,我得到了 table 的一张小图片,里面有一个大(不可见)子图,占据生成的90% window.
我使用了这个代码:
# ...
ax = plt.subplot()
ax.xaxis.set_visible(False)
ax.yaxis.set_visible(False)
ax.spines['right'].set_visible(False)
ax.spines['top'].set_visible(False)
ax.spines['left'].set_visible(False)
ax.spines['bottom'].set_visible(False)
coeficientes_real_2 = coeficientes_real.transpose()
table(ax, coeficientes_real_2, colWidths=[0.1, 0.1, 0.1], loc='center')
plt.savefig('mytable.png')
plt.show()
#...
得到这个结果:
如何增加 table 的大小?
基于thispost,您可以将整个table扩展为
tb = table(ax, coeficientes_real_2, colWidths=[0.1, 0.1, 0.1], loc='center')
tb.scale(2,2)
或单独更改列宽和字体大小:
tb = table(ax, coeficientes_real_2, colWidths=2*[0.1, 0.1, 0.1], loc='center')
tb.set_fontsize(24)
我试图将 pandas 数据帧显示为图像,但是当我使用 plt.show() 时,我得到了 table 的一张小图片,里面有一个大(不可见)子图,占据生成的90% window.
我使用了这个代码:
# ...
ax = plt.subplot()
ax.xaxis.set_visible(False)
ax.yaxis.set_visible(False)
ax.spines['right'].set_visible(False)
ax.spines['top'].set_visible(False)
ax.spines['left'].set_visible(False)
ax.spines['bottom'].set_visible(False)
coeficientes_real_2 = coeficientes_real.transpose()
table(ax, coeficientes_real_2, colWidths=[0.1, 0.1, 0.1], loc='center')
plt.savefig('mytable.png')
plt.show()
#...
得到这个结果:
如何增加 table 的大小?
基于thispost,您可以将整个table扩展为
tb = table(ax, coeficientes_real_2, colWidths=[0.1, 0.1, 0.1], loc='center')
tb.scale(2,2)
或单独更改列宽和字体大小:
tb = table(ax, coeficientes_real_2, colWidths=2*[0.1, 0.1, 0.1], loc='center')
tb.set_fontsize(24)