pythonにてMatplotlib.pyplot を用いてグラフの描画をしようとしているのですが、plt.textが入るとグラフが暗転?してしまいグラフが表示されなくなります。解決方法を教えていただけると幸いです。
python
1import numpy as np 2import matplotlib.pyplot as plt 3 4n = np.array([i for i in range(100)]) 5y1 = 8 * n ** 2 6y2 = 64 * n * np.log2(n) 7 8idx = np.argwhere(np.diff(np.sign(y1 - y2)) != 0) 9plt.plot(n[idx], y1[idx], 'ms', ms=5, label='Intersection', color='green') 10plt.xlabel("n") 11plt.ylabel("Execution Time") 12plt.text(n[idx], y1[idx], "Intersection", fontsize=12) 13plt.plot(n, y1, color='red', label='Insertion-sort') 14plt.plot(n, y2, color='blue', label='Merge-sort') 15plt.legend 16plt.grid() 17plt.show()
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/04/30 04:26