我想将没有插值的热图导出为 EPS 文件。使用imshow()
with interpolation='nearest'
,如果我导出为 PDF(或 PNG 或 SVG),图像看起来正确,没有插值。但如果我导出为 EPS,它似乎忽略了interpolation='nearest'
.
有没有什么方法可以导出为 EPS 而无需插值?
以下是演示导出文件类型差异的示例代码:
import numpy as np
import matplotlib.pyplot as plt
data = np.random.rand(4,4)
fig = plt.figure()
ax = fig.add_subplot(111)
ax.imshow(data,interpolation='nearest')
fig.savefig('test.eps')
fig.savefig('test.pdf')
fig.savefig('test.png')