October 2018
Beginner to intermediate
676 pages
18h 30m
English
One more very common option to use the legend is with loc argument on plt.legend(). This argument can take the codes 0 to 10 to specify different locations on the plot. Each of them also has a text description, which can be found on the Matplotlib documentation (https://matplotlib.org/api/legend_api.html?highlight=legend#module-matplotlib.legend).
The following is the sample code for two of the possible options:
plt.legend(loc='best') or plt.legend(loc=0)plt.legend(loc=‘upper right’) or plt.legend(loc=1)
Read now
Unlock full access