Print figure or save to specific file format
print(
saves
the current figure to a file using the specified file format, such
as filename
,formattype
)print('BarPlot','-dpng')
. If the file name does
not include an extension, then print
appends the
appropriate one.
print(
specifies
additional options that are available for some formats.filename
,formattype
,formatoptions
)
print
prints the current figure to the
default printer.
print(
specifies
the printer. Specify the printer as a character vector containing
the printer name preceded by printer
)-P
, for example, '-Pmy
printer'
. The printer must be set up on your system.
print(
specifies
the driver. Use this option if you want to ensure that the printed
output is either black and white or color.driver
)
print(
copies
the current figure to the clipboard using the format specified by '-clipboard'
,clipboardformat
)clipboardformat
.
You can paste the copied figure into other applications.
print(
maximizes
the figure size to fill the page. Specify resize
,___)resize
as '-bestfit'
to
preserve the figure's aspect ratio or '-fillpage'
to
ignore the aspect ratio. These options are valid only when saving
to a page format (PDF, and PS) or printing to a printer.
print(
uses
the specified resolution. Specify the resolution as a character vector
containing an integer value preceded by resolution
,___)-r
, for
example, '-r200'
. Use this option with any of the
input arguments from the previous syntaxes.
print(
uses
the specified renderer. Specify the renderer as either renderer
,___)'-painters'
or '-opengl'
.
print(
excludes
user interface controls, such as push buttons and sliders, from the
saved or printed output. It does not exclude user interface objects
that can contain an axes, such as a uitab or uipanel.'-noui'
,___)
returns
the RGB image data for the current figure. This option differs from
screen captures in that all printing features apply to the output.
You can also specify the cdata
= print('-RGBImage');resolution
, renderer
, '-noui'
,
and fig
options with this syntax. However, you
cannot specify a Simulink block diagram.
print
does not support capturing ActiveX® controls.
Starting MATLAB in no display mode on Linux or
using the -noFigureWindows
startup option on any
platform has these limitations for print
:
Printing or saving figures with visible uicontrols
errors. To print or save the figure, hide the uicontrols by setting
their Visible
properties to 'off'
,
or use the '-noui'
option with the print
function.
Always uses the painters renderer, even if you specify
the '-opengl'
option.