matplotlib在.eps文件中的AxesSubplot外绘制轮廓标签

时间:2011-11-18 21:04:54

标签: python matplotlib eps

我正在使用matplotlib.pyplot导入为PL:

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的极限之外绘制轮廓标签,即,在图4的空白区域中。这只发生在.eps文件中,但不适用于.png或.pdf。巧合的是,我需要.eps。

有关如何解决此问题的任何提示?

1 个答案:

答案 0 :(得分:1)

听起来像你可以提交为an issue on Github的错误,但作为一种解决方法,如果pdf输出看起来正确,你可以使用pdftops(附带xpdf)然后使用ps2eps