How would I move my legend to inside the graph right under where my title is?
plt.plot([1, 2], [3, 4], color='r', label="Apple")
plt.plot([3, 4], [5, 6], color='g', label="Pear")
plt.title("Total Profit Trend by Month")
plt.legend()
plt.show()
How would I move my legend to inside the graph right under where my title is?
plt.plot([1, 2], [3, 4], color='r', label="Apple")
plt.plot([3, 4], [5, 6], color='g', label="Pear")
plt.title("Total Profit Trend by Month")
plt.legend()
plt.show()
You can use: plt.legend(loc='upper left')
or you can replace 'upper left' by the following locations:
upper right, lower left, lower right, right, center left, center right, lower center, upper center, center.