FigureSubplot matplotlibFigureplt.figureFigure. Other answers seem a bit complex, you can just add a parameter 'label' in scatter function and that will be the legend for your plot. import matplo scatter plot legend - matplotlib-users - Matplotlib notice that needed , after the 'aLabel', legend(('aLabel1', 'aLabel2', 'aLabel3'), 'upper left'). (And if I do that, can I get it Another example using Proxy artists ): How to add a legend for a scatter plot in matplotlib ? fig, ax = plt.subplots() import seaborn as sns if you are using matplotlib version 3.1.1 or above, you can try: Furthermore, to replace labels with classes names, Minimising the environmental effects of my dyson brain. What paramaters do I pass to the legend() function to achieve this? However I can't seem to set line from matplotlib.colors import ListedColormap Or here, we create new Line2D objects, and give them to the legend. ax.legend () plt.show () Matplotlib legend inside. Matplotlib legend on bottom. To place the legend on the bottom, change the legend () call to: ax.legend (loc='upper center', bbox_to_anchor= (0.5, -0.05), shadow=True, ncol=2) Take into account that we set the number of columns two ncol=2 and set a shadow. I want a legend box that says "
Appropriate Gift For Grieving Child,
Carmine's Newburyport,
Articles M
matplotlib scatter plot legend