How to manually add a legend with a color box on a Matplotlib figure ?
A legend is basically an area in the plot which describes the elements present in the graph. Matplotlib provides an inbuilt method named legend() for this purpose. The syntax of the method is below :
Example: Adding Simple legend
Creating legend with color box
To create a legend with a color box, patches are used provided by the matplotlib.patches module. A patch nothing but a 2D artist with face color and edge color. Below is a simple example of this:
My Personal Notes arrow_drop_up
Please Login to comment...