Skip to Main Content Skip to Search
Product Documentation

Working in Plot Edit Mode

Figure Windows in Plot Edit Mode

The MATLAB figure window supports a point-and-click editing mode that you can use to customize the appearance of your graph. This section describes how to enter plot edit mode and perform basic editing tasks, including selecting, cutting, copying, pasting, moving, and resizing objects and modifying other plot properties. The following figure illustrates some capabilities of plot edit mode.

Starting Plot Edit Mode

Before you can select objects in a figure by clicking on them, you must activate plot editing mode. There are several ways to activate plot edit mode:

When a figure window is in plot edit mode, the Edit Plot option on the Tools menu is checked and the selection button in the toolbar is depressed.

Exiting Plot Edit Mode

To exit plot edit mode, click the selection button or click the Edit Plot option on the Tools menu. When plot edit mode is turned off, the selection button is no longer depressed.

Selecting Objects in a Graph

To select an object in a graph,

  1. Start plot edit mode.

  2. Move the cursor over the object and click it.

    Selection handles appear on the selected object.

Selecting Multiple Objects

To select multiple objects at the same time,

  1. Start plot edit mode.

  2. Move the cursor over an object and Shift+click to select it. Repeat for each object you want to select.

You can perform actions on all the selected objects. For example, to remove a textbox annotation and an arrow annotation from a graph, select the objects and then select Delete or Cut from the Edit menu (Cut keeps a copy on the clipboard, Delete does not).

Deselecting Objects

To deselect an object, move the cursor off the object onto the figure window background and click the left mouse button (this deselects all selected objects and selects the one you clicked). You can also Shift+click on a selected object to deselect it (doing this will not deselect any other object).

Cutting, Copying, and Pasting Plot Objects

To cut an object from a graph, or copy and paste an object in a graph, perform these steps:

  1. Start plot edit mode.

  2. Select the object.

  3. Select the Cut, Copy, or Paste option from the Edit menu or use standard shortcut keys for your platform.

Alternatively, with plot edit mode enabled, you can right-click on an object and then select an editing command from the context menu associated with the object.

Copying and Pasting Multiple Objects

When you cut or copy axes and plot objects such as lineseries or barseries from a figure and paste them there or elsewhere, the results depend on what you select and the type of container into which you paste the objects.

Copy and Paste Axes.  The following semantics apply to copying and pasting axes into the same or different figure:

Select, Copy, and Paste Axes

Result of Pasting Axes

Select axes Ax1 from figure Fig1, copy and paste it into Fig2, which has no axes.

New axes Ax2 is created in Fig2. Ax2 inherits all properties of Ax1, including all children. Ax1 will be selected in Fig1; Ax2 will be selected in Fig2.

Select axes Ax1 from figure Fig1, copy and paste (from Edit Menu) into Fig2, that contains axis Ax2 which is not selected.

New axes Ax3 is created in Fig2. All children of Ax1 are copied to Ax3. All the selected objects in Fig2 are deselected, and the pasted axes Ax3 is selected. The selections in Fig1 are unchanged.

Select axes Ax1 from figure Fig1, copy and paste into Ax2 in the same or different figure.

New axis Ax3 is created having the same properties (including position) and children as Ax1; any selected objects in Ax2 are deselected, and axes Ax3 is selected. When pasting to a new figure, selections in Fig1 will be unchanged.

Select axes Ax1 from figure Fig1, copy and paste into same or different axes in Fig1.

New axes Ax2 is added to Fig1, offset from Ax1, and is the only selected object.

Copy and Paste Plot Objects.  The following semantics apply to copying and pasting plot objects (lines are used as examples) from one axes into the same or different figure:

Select, Copy, and Paste Objects

Result of Pasting Objects

Select and copy one or more lines from axes Ax1 and paste into selected axes Ax2 in the same or different figure.

The lines are added to Ax2; the pasted lines are the only selected objects in the destination figure.

Select and copy lines from axes Ax1 in Fig1 and paste into figure Fig2, which contains no axes or has no axes selected.

New axes Ax2 is created in Fig2 containing the lines, which are selected in it; Ax2 has default axes properties.

Select and copy lines from axes Ax1 and paste into selected axes Ax2 and Ax3.

Lines are pasted into both Ax2 and Ax3; all the pasted lines are selected.

Select and copy lines from axes Ax1 and paste into selected axes Ax1.

Nothing is pasted, as the extra content would be redundant.

Copy and Paste Plot Objects from Multiple Axes.  The following semantics apply to copying and pasting plot objects (lines are used as examples) from one or more axes into the same or different figure:

Select, Copy, and Paste Objects

Result of Pasting Objects

Select and copy Line1 from axes Ax1 and Line2 from axes Ax2 and paste into axes Ax3.

Two lines are pasted into axes Ax3 and are the only selected objects there.

Select and copy lines from axes Ax1 and axes Ax2 and paste into figure Fig2, which contains no axes or has no axes selected.

New axes Ax3 is created in Fig2, into which all the lines are pasted; Ax3 has default axes properties.

Select and copy multiple lines from Axes Ax1 and axes Ax2 and paste into Ax1, Ax2, or some other axes.

Only those lines that did not originate in an axes are pasted into it, and the pasted lines are the only selected objects.

Copy and Paste Multiple Axes and Plot Objects.  The following semantics apply to copying and pasting several axes and selected plot objects (lines are used as examples) from one or more axes into the same or different figure:

Select, Copy, and Paste Objects

Result of Pasting Objects

Select Line1 from axes Ax1, select axes Ax2, and paste into figure Fig2, which contains no axes or has no axes selected.

Ax2 and its contents is pasted as new axes Ax3; another new axis Ax4 is created into which the line is pasted

Select Line1 from axes Ax1, select axes Ax2, and paste into axes Ax3.

Line1 is pasted into axes Ax3 and axes Ax2 is pasted as new axis Ax4.

Select axes Ax1 and Line1 from Ax1, and paste into Ax1.

New axes Ax2 is created having all the properties of Ax1 but containing Line1 as its only child.

Select axes Ax1 and Line1 from Ax1 in Fig1 and paste into figure Fig2, which contains no axes or has no axes selected.

Line1 is pasted in new axes Ax2, and Ax1 and its children (including Line1) is pasted as new axis Ax3.

Select axes Ax1 and Line1 from Ax1, and paste into axes Ax2.

New axes Ax3 is created having all the properties of Ax1 but containing Line1 as its only child.

Copying and Pasting Annotation Objects

In plot edit mode you can copy and paste annotations such as textboxes, textarrows, rectangles, and ellipses, in various combinations. If any such objects happen to be pinned to their axes (see Pinning — Attaching to a Point in the Graph), their copies are pasted unpinned. As annotation objects are children of figures, they never create new axes when you paste them.

Moving and Resizing Objects

To move or resize an object in a graph, perform these steps:

  1. Start plot edit mode.

  2. Select the object. Selection handles appear on the object When the cursor is over the object, it turns into crossed arrows; outside the selection it reverts to a pointer.

To move the object, drag it to the new location. You can also nudge it one pixel up, down, left, or right with the appropriate arrow key on your keyboard. If you have selected Snap to Layout Grid from the Tools menu, each keypress makes objects move to the next grid position.

To resize the object, drag a selection handle.

You can shift-click to select multiple objects and move them as a group. Arrow keys work well for this. However, when you resize one of several selected objects, only that object changes size.

Setting Object Properties

In MATLAB graphics, every object in a graph supports a set of properties that control the graph's appearance and behavior. For example, line objects have properties that control thickness, color, and line style.

Double-clicking on an object displays the Property Editor. To edit the properties of the axes or figure, double-click on a region that does not contain other objects.

See The Property Editor for more information.

Undo/Redo — Eliminating Mistakes

The figure Edit menu contains two items that enable you to undo recent operation.

Undo — Remove the effect of the last operation.

Redo — Perform again the last operation that you removed by selecting Undo.

For example, if you create a plot, zoom in, pan the view, and then undo the pan operation, the menu looks as follows:

You could now undo the previous zoom operation or redo the pan operation you just undid.

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS