在 python 的matplotlib.fill_between
以下最小工作示例中,正确地绘制到屏幕,并绘制到.png
. 然而,在结果.pdf
中,边缘线仍然被绘制。我怎样才能解决这个问题?
from numpy import *
import pylab as plt
# Sample data
X = linspace(0,2*pi,1000)
Y0 = sin(X)
Y1 = sin(X+.2)
Y2 = sin(X+.4)
# fill_kwargs (what am I missing?)
fbk = {'lw':0.0, 'edgecolor':None}
ax = plt.subplot(111)
ax.fill_between(X, 0, Y0 , facecolor = 'b', **fbk)
ax.fill_between(X, Y0, Y1, facecolor = 'g', **fbk)
ax.fill_between(X, Y1, Y2, facecolor = 'r', **fbk)
plt.xlim(pi-.8,pi+.5)
plt.ylim(-.5,.5)
plt.savefig('fA.png') # No edge lines
plt.savefig('fA.pdf') # Edge lines!
PNG结果
PDF 结果
虽然看起来微不足道,但当你堆叠 200 个地块时,它变得非常fill_between
有问题,你所看到的只是一团难看的黑色!