0
想要連接matplotlib中的點plot.below是示例代碼。列表中的每個元素都有時間戳和argv。請教育。下面代碼繪製正確,但不要連接列表的不同元素之間的點,即使我提到'rs-'。如何連接python plot中的點?
for a in list:
plt.plot(a.time,a.argv,'rs-')
想要連接matplotlib中的點plot.below是示例代碼。列表中的每個元素都有時間戳和argv。請教育。下面代碼繪製正確,但不要連接列表的不同元素之間的點,即使我提到'rs-'。如何連接python plot中的點?
for a in list:
plt.plot(a.time,a.argv,'rs-')
如果你想連接點,你需要在一次調用中繪製它們。創建要繪製點的列表,然後致電plt.plot
points = [(a.time, a.argv) for a in l]
plt.plot(points, "rs-")
該代碼適用於我,它會創建一條連接點。你想要在* list的不同元素之間連接點*嗎? –