Main Content

Copy Figure to Clipboard

Since R2025a. Replaces Copy Figure to Clipboard from Edit Menu (R2024b).

To copy the contents of a figure to the clipboard, use one of these methods:

  • Use the figure toolstrip — On the Figure tab, click Copy Figure. This method uses preconfigured options, such as the dimensions, resolution, and whether the content is copied as pixels or vector graphics. You can access these options in the MATLAB® Settings window. The following section describes how to set the options.

  • Use the copygraphics function — Pass a figure to the copygraphics function. This function has several arguments for specifying how the content is copied, such as the width, height, resolution, and whether the content is copied as pixels or vector graphics. For more information, see Export Figures for Use in Other Applications.

  • Use the axes toolbar — In the upper-right corner of a plot, place your cursor over the Export button of the axes toolbar and expand the menu. This menu has options for copying your plot as an image or vector graphic. When you use this method, you can copy only the plot containing the axes toolbar. For more information about the axes toolbar, see Interactively Explore and Analyze Plotted Data.

Note

The figure toolstrip and copygraphics function do not copy containers (such as panels) that are adjacent to other containers or plots. To capture the entire content of a figure with child containers, use the exportapp function.

Specify Figure Copy Settings

Use the MATLAB Settings window to specify options for copying figures to the clipboard using the figure toolstrip. MATLAB uses these options every time you copy a figure from the toolstrip, but the options do not affect the on-screen appearance of the figure.

To access these options, on the Home tab, in the Environment section, click Settings. Then select MATLAB > Figure Copy.

Figure Copy Settings page

This table describes each of the options.

SectionOptions

Output Size

  • Match on-screen size — Copy the contents of the figure using the same size and resolution as the on-screen figure. When this option is selected, the other output options are disabled. To enable those options, clear the Match on-screen size checkbox.

  • Maintain aspect ratio — Preserve the aspect ratio of the original graphic. For example, if you change the width, MATLAB adjusts the height to preserve the aspect ratio.

  • Width — Custom width in the specified units.

  • Height — Custom height in the specified units.

  • Units — Units for the width and height values. If you set the units to Pixels, the Content Type list is disabled with the value set to Image. Selecting any of the other units reenables the Content Type list. However, when you select other units, you must also specify the Content type as Vector or Image.

Other Settings

  • Content Type — Type of content to copy. To access the options in this list, select a Units value other than Pixels.

    • Vector — Copy the figure as a vector graphic.

    • Image — Copy the figure as an image.

    • Auto — MATLAB selects the content type based on the content in the figure. This option is available only when the Match on-screen size checkbox is selected.

  • Resolution (DPI) — Dots per inch (DPI) for image content.

  • Background color — Color of the space that surrounds the axes or chart. You can select a color from the drop-down menu or specify an RGB triplet in the box. If you set the Color property of the figure and choose Auto, the background stays the same color. If you do not set the Color property, Auto sets the color to white in the light theme or dark gray (almost black) in the dark theme.

  • Grayscale — Copy grayscale content.

  • Restore Defaults — Reset all the options to the default values.

See Also

Topics