2017-04-10 5 views
0

enter image description here各プロットラインに「1対1」の伝説を追加する方法(Pythonでmatplotlibの)

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() 
伝説を参照してくださいが、それは一種の乱雑に見えます。それに応じて各プロットに各ラベルを割り当てる方法を知っていますか?これはあなたが探しているものですが、私は各プロットに明確な割り当てを得た場合

+2

が重複する可能性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() 
[私はmatplotlibの中で一度に複数のラベルを割り当てる方法を教えてください](の
関連する問題