在渲染为pdf时,Matplotlib不显示阴影

我试图在matplotlib中使用阴影功能,在显示到屏幕时工作正常。 但是,当我将图保存为pdf格式时,不会呈现阴影标记:

import matplotlib
import matplotlib.pyplot as plt
import numpy as np

x = np.linspace(0,2*np.pi,100)

plt.figure()
plt.fill(x,np.sin(x),color='blue',alpha=0.5,hatch='/')
plt.show()
plt.savefig('./test.pdf',format='pdf')

我在OS X 10.6.6的pylab中使用matplotlib 1.0.1。 这可能是与后端渲染器有关的平台特定问题,但我不确定。 任何建议将不胜感激。


看起来像一个错误。 请将其归档到github问题跟踪器中。

与此同时,这是一个解决方法:

plt.fill(x,np.sin(x),color='blue',alpha=0.5)
plt.fill(x,np.sin(x),color='None',alpha=0.5,edgecolor='blue',hatch='/')
链接地址: http://www.djcxy.com/p/51189.html

上一篇: Matplotlib does not display hatching when rendering to pdf

下一篇: NfcAdapter.getDefaultAdapter(this) returns null in emulator