I am using matplotlib 1.10.1. The following code plots a scatter plot and adds a legend in the "best" location.
import matplotlib.pyplot as plt
import numpy as np
x=np.linspace(1.1,2.8)
for i in range(0, 5):
plt.scatter(x, x, label='Scatter%d' % i)
#plt.plot(x, x)
#plt.legend(loc='upper left')
plt.legend(loc='best')
plt.show()
However, the legend appears in the upper right corner covering some points. I was expecting it to appear in the upper left corner where there is no data. Plotting a line instead of a scatter plot seems to produce the expected behaviour.
Is there a way to fix the "best" legend location for scatter plots?
Thanks