Graphics | ![]() ![]() |
Using the Legend Function
To add a legend to a graph at the MATLAB command prompt or from an M-file, use the legend
function. You must specify the text labels when you create a legend using the legend
function.
For example, the following code adds a legend to the current axes.
The legend
function lets you specify many other aspects of the legend, such as its position. For more information, see the legend
function reference information.
![]() | Using the Legend Option on the Insert Menu | Positioning the Legend | ![]() |