可以从pyplot.figure()
中移除坐标轴吗?
使用pyplot.imsave()
创建没有坐标轴的图像是可行的。
plt.imsave(file, zi)
但是它的应用范围受限,因为它只适用于网格数据。
当我使用pyplot.figure()
并按照以下方式使用pyplot.savefig()
保存时:
...
# create figure
fig = plt.figure(figsize=(1.0,1.0))
# apply contour plot
plt.contour(zi,15,linewidths=0.1,colors='k')
plt.contourf(zi,15,cmap=plt.cm.jet)
# flip the y-axis
ax = plt.gca()
ax.set_ylim(ax.get_ylim()[::-1])
# save to file, 256x256 pixels
plt.savefig(file1, dpi=256)
保存的图片保留了其轴线,如上图所示。