In Pythons matplotlib.fill_between
wird das folgende minimale Arbeitsbeispiel unten korrekt auf den Bildschirm gezeichnet und auf die .png
. In dem resultierenden .pdf
sind jedoch die Kantenlinien noch gezeichnet. Wie kann ich das beheben?Warum zeichnet matplotlib fill_between Zeichenkanten nur in PDFs auf?
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 Ergebnis
PDF Ergebnis
Während es trivial scheint, es extrem problematisch wird, wenn Sie 200 fill_between
Plots stapeln, alles, was Sie sehen ist eine hässliche Unordnung von Schwarz!