This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Using Graphics Smoothing

This example shows how to use graphics and font smoothing in MATLAB plots.

What is Graphics Smoothing?

Graphics smoothing improves the appearance of graphics in plots. Smoothing removes jagged edges that result from using pixels or dots to represent continuous objects. Techniques used for graphics smoothing include multi-sampling and anti-aliasing.

Graphics Smoothing in a Figure

Graphics smoothing is controlled in a figure by using the GraphicsSmoothing property. By default, the GraphicsSmoothing property is set to 'on'.

f = figure;

You can turn off graphics smoothing by setting the GraphicsSmoothing property to 'off'.

f.GraphicsSmoothing = 'off';

Font Smoothing for Text and Axes Objects

The FontSmoothing property of a text or an axes object controls how text is rendered. When FontSmoothing is set to 'on', text will be drawn with smoothed edges. Font smoothing is 'on' by default.

t = text(14,27,-8.5, 'Minimum of Peaks');

t.FontSmoothing = 'off';

Why Turn Graphics Smoothing Off?

Without graphics smoothing, horizontal and vertical lines will appear sharper. Certain chart types may look better when graphics smoothing is turned off. Similarly, turning off font smoothing may make text using small fonts appear clearer.


ax = gca;                       % get current axes          
ax.FontSmoothing = 'off';       % turn off axes font smoothing

f.GraphicsSmoothing = 'off';    % turn off figure graphics smoothing