Graphics |
Editing the Legend
A legend is implemented as a separate axes object containing one or more line objects, representing samples of the plots in the graph, and one or more text objects, representing the labels for each data set plotted in a graph.
You can edit a legend when plot editing mode is enabled or when it is not enabled.
Editing a Legend in Plot Editing Mode
When you enable plot editing mode, you can edit any of the objects that make up a legend as you would any other axes, line, or text object in a graph. For example, if you double-click on the legend axes, the Property Editor displays the set of property panels for axes objects. Change the value of an axes property and click Apply.
If you double-click on a text label in a legend, MATLAB opens a text editing box around all the text labels in the legend. You can edit any of the text labels in the legend. To access the properties of these text objects, right-click on a text label and select Properties from the context-sensitive pop-up menu.
Editing a Legend When Plot Editing Mode Is Not Enabled
When plot editing mode is not enabled, you can still edit the text labels in a legend:
MATLAB automatically resizes the legend box to fit long or multiline labels.
Resizing a Legend
Note If the text labels extend past the legend axes border, you cannot grab the selection handles on the right side of the legend axes. Resize the axes from the left side to fit the new text labels. |
Removing the Legend
If you have enabled plot editing mode, you can remove a legend by clicking on it and choosing the Cut option on the Edit menu. You can also remove a legend by right-clicking on it and selecting Cut from the context-sensitive pop-up menu.
If plot editing mode is not enabled, you can remove a legend by selecting the Legend option on the Insert menu. The Legend options acts as a toggle switch -- selecting it alternately adds or removes a legend.
Positioning the Legend | Adding Axis Labels to Graphs |