2011-11-18 124 views
2

我想提出一个阴谋使用matplotlib.pyplot导入为PL:matplotlib绘制等高线标签AxesSubplot外.EPS文件

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,即,在图7的空白区域中。这只发生在.eps文件中,但不是.png或.pdf。巧合的是,我需要.eps。

任何提示如何补救?

+0

是否有一个特殊的理由将'pyplot导入为PL'?为什么不是传统的'plt'。坦率地说,它看起来很奇怪。 'FIG'一样。 – joaquin

+0

没有真正的原因,真的。 – milancurcic

+0

您可以在[PEP-8](http://www.python.org/dev/peps/pep-0008/ – joaquin

回答

1

听起来像一个bug,你可以将其作为an issue on Github,但作为一种解决方法,如果pdf输出看起来正确,可以使用pdftops(自带xpdf),然后使用ps2eps

+0

)中检查常量和变量的'命名惯例'。谢谢,这当然是一种解决方法。如果我发现任何东西,我会更新。 – milancurcic