2

I am making a plot using matplotlib.pyplot imported as 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()

The problem that I have is that PL.clabel draws contour labels even outside limits of AX, that is, in the whitespace of FIG. This happens only in .eps file, but not for .png or .pdf. Coincidentally, I need .eps.

Any hints on how to remedy this?

4

1 回答 1

1

听起来像是一个错误,您可以在 Github 上将其作为问题提交,但作为一种解决方法,如果 pdf 输出看起来正确,您可以使用 pdftops (附带 xpdf),然后使用 ps2eps

于 2011-11-19T05:26:52.140 回答