[英]matplotlib fill between discrete points
I have the following few data points (no equation to address y1 and y2). 我有以下几个数据点(没有方程可解决y1和y2)。
Q: How can I fill the area between the points with a different color? 问:如何用不同的颜色填充点之间的区域? Thanks! 谢谢!
import matplotlib.pyplot as plt
from matplotlib.figure import Figure
X=[-10,-15,-20,-25,-100,-200,-300,-400,-500,-600]
Y=[35,20,10,8,6,12,15,20,25,30]
fig = plt.figure()
ax= fig.add_subplot ( 111 )
ax.plot(Y,X,'ro-')
ax.text(20, -200, 'HOW TO FILL HERE?', fontsize=30)
plt.show()
Please just do: 请执行以下操作:
plt.fill_betweenx(X, Y, 35) #or max(X) or whatever cut-off you may want.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.