from matplotlib import pyplot as plt
x = range(10)
y = range(10)
z = [[z] * 10 for z in range(10)]
num_bars = 100 # more bars = smoother gradient
plt.contourf(x, y, z, num_bars)
background_color = 'w'
plt.fill_between(x, y, y2=max(y), color=background_color)
plt.show()
有一个更接近问题草图的替代解决方案。这是亨利·巴特的博客上写的。 这将对每个补丁应用imshow,我已经复制了代码以防链接更改
也许有更好的方法,但这里有:
显示:
相关问题 更多 >
编程相关推荐