我正在寻找填充matplot中两行之间的区域。有什么办法吗?
a = [[12, 17, 26, 32, 34], [235.910888671875, 245.84429931640625, 211.8711395263672, 226.2964630126953, 222.0032501220703]]
b = [[12, 26, 34], [235.910888671875, 211.8711395263672, 222.0032501220703]]
plt.plot(a[0], a[1], c='r')
plt.plot(b[0], b[1], c='r')
答案 0 :(得分:2)
这里是:
import matplotlib.pyplot as plt
import numpy as np
a = [[12, 17, 26, 32, 34], [235.910888671875, 245.84429931640625, 211.8711395263672, 226.2964630126953, 222.0032501220703]]
b = [[12, 26, 34], [235.910888671875, 211.8711395263672, 222.0032501220703]]
plt.plot(a[0], a[1], c='r')
plt.plot(b[0], b[1], c='r')
plt.fill_between(a[0], a[1],np.min(a[1]))
plt.fill_between(b[0], b[1],np.min(a[1]),color='white')
plt.show()