我正在使用导入为 PL 的 matplotlib.pyplot 制作绘图:
FIG = PL.figure(figsize=(12,8), dpi=150)
AX = FIG.add_subplot(111, aspect='equal', xlim=(lonMin,lonMax), ylim=(latMin,latMax))
PL.contourf(lon, lat, swath, range(2,56,1))
PL.colorbar(shrink=0.8, extend='both', ticks=range(5,55,5))
CNTR = PL.contour(lon, lat, rain, colors='black', linewidths=1)
PL.clabel(CNTR, fmt='%2i', inline_spacing=2)
PL.savefig('swaths_ao.png', bbox_inches='tight')
PL.savefig('swaths_ao.eps', bbox_inches='tight')
PL.savefig('swaths_ao.pdf', bbox_inches='tight')
PL.clf()
我遇到的问题是 PL.clabel 甚至在 AX 的限制之外绘制轮廓标签,也就是说,在图的空白处。这只发生在 .eps 文件中,但不会发生在 .png 或 .pdf 文件中。巧合的是,我需要 .eps。
关于如何解决这个问题的任何提示?
请您参考如下方法:
听起来像是一个错误,您可以将其归档为 an issue on Github ,但作为解决方法,如果 pdf 输出看起来正确,您可以使用 pdftops(xpdf 附带),然后使用 ps2eps .
