This example shows how to use the Export Setup window to customize a figure before saving it. It shows how to change the figure size, background color, font size, and line width. It also shows how to save the settings as an export style that you can apply to other figures before saving them.
Create a line plot.
x = linspace(0,10); y = sin(x); plot(x,y)
Set the figure size by clicking File > Export Setup. Specify the desired dimensions in the Width and Height fields, for example 5-by-4 inches. The dimensions include the entire figure window except for the frame, title bar, menu bar, and any tool bars. If the specified width and height are too large, then the figure might not reach the specified size.
To make the axes fill the figure, select Expand axes to fill
figure. This option only affects axes with an
ActivePositionProperty property set to
By default, it does not affect subplots since subplots have an
ActivePositionProperty set to
Click Apply to Figure. Applying the settings changes the appearance of the figure on the screen. All settings from the Export Setup dialog are applied to the figure. Thus, more than just the figure size can change. For example, by default, MATLAB® converts the background color of the saved figure to white.
Set the figure background color by clicking the Rendering property in the Export Setup window. In the Custom color field, specify either a color name from the table or an RGB triplet. For example, set the background color to yellow.
An RGB triplet is a three-element row vector whose elements specify the intensities of the
red, green, and blue components of the color. The intensities must be in the range
[0,1], for example,
[0.4 0.6 0.7]. This table lists some
common RGB triplets that have corresponding color names. To specify the default gray background
color, set the Custom color field to
|Long Name||Short Name||Corresponding RGB Triplet|
Change the font by clicking the Fonts property. Specify a fixed font size and select a font name, font weight, and font angle. For example, use 20 point bold font. The tick mark locations might change to accommodate the new font size.
Change the line width by clicking the Lines property. Specify a
fixed line width, for example,
Click Apply to Figure on the right side of the Export Setup dialog.
Save the figure to a file by first clicking Export, and then
specifying a file name, location, and desired format. For more information about file formats,
Save your settings to use for future figures by creating an export style. In the Export
Styles section, type a style name, for example
MyCustomSettings. Then, click Save.
Apply your settings to another figure by opening the Export Setup box from its figure menu. In the Export Styles section, select the style name and click Load. Next, click Apply to Figure on the right side of the Export Setup dialog. MATLAB applies the saved style settings to the figure.
Restore the figure on the screen to the original settings by clicking Restore Figure.