在将matplotlibs fill_between与差距很小的数据一起使用时,我遇到了一个奇怪的问题。例如,当我只想绘制以下数据并将其保存为SVG时,它就可以工作:
import matplotlib.pyplot as plt
plt.fill_between([0,1e4-1000,1e4,1e4+1000,1e6], [1000,1000,1,1000,1000])
plt.savefig("test.svg")
但是当我将颜色设置为任何值时,间隙消失了:
import matplotlib.pyplot as plt
plt.fill_between([0,1e4-1000,1e4,1e4+1000,1e6], [1000,1000,1,1000,1000], color='tab:red')
plt.savefig("test_colored.svg")
如何在不消失此间隙的情况下更改绘图颜色?
我尝试将capstyle
,joinstyle
,antialiased
,rasterized
等不同的kwarg设置为所有可能的值,但均未成功。