Copy Figure to Clipboard from Edit Menu
This example shows how to copy a figure to the clipboard and how to set copy options. When a figure is on the clipboard, you can paste it into other applications, such as a document or presentation.
Copy Figure to Clipboard
Create a bar chart with a title. Copy the figure to your system clipboard by clicking Edit > Copy Figure.
x = [3 5 2 6 1 8 2 3];
bar(x)
title('Bar Chart')
Paste the copied figure into other applications, typically by right-clicking. By default, MATLAB® converts the background color of the copied figure to white.
Note
The Copy Figure option is not available on Linux® systems. Use the programmatic alternative.
To copy the figure programmatically, use the '-clipboard'
option with print
. Specify the format as either
'-dbitmap'
, '-dpdf'
, or
'-dmeta'
. The metafile format, '-dmeta'
,
is supported on Windows® systems only.
Specify Format, Background Color, and Size Options
You can adjust certain settings for figures that are copied to the clipboard. Access these options by selecting Edit > Copy Options from the figure menu. The settings apply to all future figures copied to the clipboard. They do not affect the way the figure looks on the screen.
Note
This window is available on Windows systems only. On Mac and Linux systems, use the programmatic alternatives.
Set the clipboard format to one of these options:
Metafile — Copy the figure in an EMF color vector format.
Preserve information — Select the format based on the figure’s renderer. If the renderer is Painters, then the format is a metafile. If the renderer is OpenGL®, then the format is a bitmap image.
Bitmap — Copy the figure in a bitmap format.
Set the figure background color to one of these options:
Use figure color — Keep the background color the same as it appears on the screen. To use the programmatic alternative, set the
InvertHardcopy
property for the figure to'off'
before copying.Force white background — Copy the figure with a white background. To use the programmatic alternative, set the
InvertHardcopy
property for the figure to'on'
before copying.Transparent background — Copy the figure with a transparent background. To use the programmatic alternative, set the
Color
property for the figure to'none'
and theInvertHardcopy
property to'off'
before copying. Metafile and PDF formats support transparency. Bitmap formats do not support transparency.
Copy the figure with the same size as it appears on the screen by selecting Match figure screen size. Clear this option to use the width and height specified in the Export Setup dialog box.