Matplotlib`fill_介于`:删除薄边界
考虑以下代码:Matplotlib`fill_介于`:删除薄边界,matplotlib,sage,Matplotlib,Sage,考虑以下代码: import matplotlib.pyplot as plt import numpy as np from pylab import * graph_data = [[0, 1, 2, 3], [5, 8, 7, 9]] x = range(len(graph_data[0])) y = graph_data[1] fig, ax = plt.subplots() alpha = 0.5 plt.plot(x, y, '-o',markersize=3, color=[
import matplotlib.pyplot as plt
import numpy as np
from pylab import *
graph_data = [[0, 1, 2, 3], [5, 8, 7, 9]]
x = range(len(graph_data[0]))
y = graph_data[1]
fig, ax = plt.subplots()
alpha = 0.5
plt.plot(x, y, '-o',markersize=3, color=[1., alpha, alpha], markeredgewidth=0.0)
ax.fill_between(x, 0, y, facecolor=[1., alpha, alpha], interpolate=False)
plt.show()
filename = 'test1.pdf'
fig.savefig(filename, bbox_inches='tight')
它很好用。但是,当放大生成的PDF时,我可以看到两条分隔线的灰色/黑色细边界:
在Edge和Chrome中查看时,我都可以看到这一点。我的问题是,我怎样才能摆脱界限
更新我忘了提到,我是用来生成图形的。现在,这似乎是Sage特有的问题,而不是Python的问题。这次我使用了本地Python,得到了正确的结果。我无法复制它,但也许您可以尝试不绘制线条
import matplotlib.pyplot as plt
import numpy as np
from pylab import *
graph_data = [[0, 1, 2, 3], [5, 8, 7, 9]]
x = range(len(graph_data[0]))
y = graph_data[1]
fig, ax = plt.subplots()
alpha = 0.5
plt.plot(x, y, 'o',markersize=3, color=[1., alpha, alpha])
ax.fill_between(x, 0, y, facecolor=[1., alpha, alpha], interpolate=False)
plt.show()
filename = 'test1.pdf'
fig.savefig(filename, bbox_inches='tight')
我也无法在我使用的任何pdf查看器中复制此内容。也许值得注意的是,Edge和Chrome通常不是很好的pdf查看器。不要从pylab import*使用,它会覆盖python内置内容,被认为是不好的做法。将matplotlib.pyplot作为plt导入,将numpy作为np导入,并使用这些缩写。