[英]How can I change the python matplotlib.pyplot legend marker into a serial number like 1,2,3 instead of shape or character?
import matplotlib.pyplot
plt.figure()
plt.plot(x, 'r+', label='one')
plt.plot(x1, 'go--', label ='two')
plt.plot(y, 'ro', label='Three')
plt.legend()
在上面的代碼中,圖例標記是“r+”、“go--”和“ro”,但我希望它變成 1,2 和 3,因為有 3 個地塊。? 誰能幫我解決這個問題? 還有什么可以在不對數字進行硬編碼的情況下完成的嗎? “““ 謝謝。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.