Legend
(Resource:examples of legend in MATLAB document)
Usage:
1.legend (' string1 ', ' string2 ',...)
' String1 ', ' string2 ' in order to correspond to the curve in the graph;
HLEG1 = Legend (' cos_x ', ' sin_x ') will return a handle HLEG1
The underscore is recognized as subscript and can be avoided by using a handle to turn off the interpreter with set (HLEG1, ' interpreter ', ' none ');
The position of the legend is set by the handle, where there are northeast, northwest, SouthWest, southeast, such as: Set (HLEG1, ' location ', ' Northwest ');
The parameters are: Northeastoutside, Northwestoutside, Southeastoutside, Southwestoutside, with the handle setting the legend position and the original image.
or set specific positions by handle, such as set (HLEG1, ' Position ', [. 1,.2,.1,.2])
The font is set to italic by the handle, and the color is brown, for example: Set (HLEG1, ' fontangle ', ' Italic ', ' textcolor ', [. 3,.2,.1]), three coordinates represent red, green and blue respectively;
2.legend (H, ' string1 ', ' string2 ',...) Use a different handle to specify the order in which to appear in the legend, such as:
HB = Bar (y1, ' stacked ');
HP = Plot (1:10,y2); Hold off
Legend ([hb,hp], ' carrots ', ' peas ', ' peppers ', ' Green Beans ', ' cucumbers ', ' eggplant ', ' location ', ' southeastoutside ')