2017-04-10 20 views
0
fig = plt.figure() 
ax1 = fig.add_subplot(111) 

ax1.plot(hpi_data, label = hpi_data.columns.values) #<-- how to add values to each plot? 
ax1.plot(benchmark, linewidth=3, label='Benchmark') 

plt.legend(loc=2, ncol=2, prop={'size':12}).get_frame().set_alpha(0.1) 
plt.show() 

enter image description here如何添加「一到一個」傳奇每個情節(在Python matplotlib)

請參閱傳說,它看起來有點凌亂。有誰知道如何爲每個標籤分配每個標籤?

+2

的[我如何在matplotlib一次指派多個標籤?(可能的複製http://stackoverflow.com/questions/11481644/how-do-i-assign-multiple-labels-at-once-in-matplotlib) – Suever

回答

0

我不知道如果這是你在找什麼,但我得到了一個明確的分配給每個情節:

f = plt.figure(1) 
plt.plot(packages, pk_dictionary.get(4), 'o-', label='delta 4') 
plt.plot(packages, pk_dictionary.get(18), 'o-', label='delta 18') 
plt.legend(loc='upper right') 
plt.title("Probabilities") 
plt.xlabel("Package amounts") 
plt.ylabel("Probability") 
f.show() 
相關問題