質問: [x for x in range (100)] plt.hist([ls1,ls2,ls3],histtype='barstacked') plt.legend(['ls1','ls2','ls3']) plt.ylim(0,50) plt.show() ![![イメージ説明](https://teratail.storage.googleapis.com/uploads/contributed_images/3ac54dc65e8a754c0761f4b558d274c0.png)]
回答: http://qiita.com/supersaiakujin/items/be4a78809e7278c065e6 上記のページを参考にして、自己解決しました。!イメージ説明 import matplotlib.pyplot as plt x1 = [x for x in range (100)] x2 = [x for x in range (100)] x3 = [x for x in range (100)] fig = plt.figure() ax = fig.add_subplot(1,1,1) ax.hist([x1, x2, x3], bins=10, label=['x1', 'x2', 'x3'], histtype='barstacked') ax.set_ylim(0,50) handles,labels=ax.get_legend_handles_labels() ax.legend(handles[::-1],labels[::-1]) fig.show()