Graphics    

Using the Legend Option on the Insert Menu

To add a legend to a graph, click on the Insert menu and choose Legend. MATLAB creates a legend, placing it in the upper right corner of the plot.

MATLAB creates text labels to identify each data set in the graph, using data1 to identify the first data set, data2 to identify the second data set, and so on. To learn how to customize a legend, such as changing its position or changing the text labels, see Positioning the Legend and Editing the Legend.


  Adding Legends to Graphs Using the Legend Function