I have the following few data points (no equation to address y1 and 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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.