Main Content

DPI-Aware Behavior in MATLAB

Starting in R2015b, MATLAB® is DPI-aware, which means that it takes advantage of your full system resolution to draw graphical elements (fonts, UIs, and graphics). Graphical elements appear sharp and consistent in size on these high-DPI systems:

  • Windows® systems in which the display dots-per-inch (DPI) value is set higher than 96

  • Macintosh systems with Apple Retina® displays

DPI-aware behavior does not apply to Linux® systems.

Previously, MATLAB allowed some operating systems to scale graphical elements. That scaling helped to maintain consistent appearance and functionality, but it also introduced undesirable effects. Graphical elements often looked blurry, and the size of those elements was sometimes inconsistent.

Visual Appearance

Here are the visual effects you might notice on high-DPI systems:

  • The MATLAB desktop, graphics, fonts, and most UI components look sharp and render with full graphical detail on Macintosh and Windows systems.

  • When you create a graphics or UI object, and specify the Units as 'pixels', the size of that object is now consistent with the size of other objects. For example, the size of a push button (specified in pixels) is now consistent with the size of the text on that push button (specified in points).

  • Elements in the MATLAB Toolstrip look sharper than in previous releases. However, icons in the Toolstrip might still look slightly blurry on some systems.

  • On Windows systems, the MATLAB Toolstrip might appear larger than in previous releases.

  • On Windows systems, the size of the Command Window fonts and Editor fonts might be larger than in previous releases. In particular, you might see a difference if you have nondefault font sizes selected in MATLAB preferences. You might need to adjust those font sizes to make them look smaller.

  • You might see differences on multiple-display systems that include a combination of different displays (for example, some, but not all of the displays are high-DPI). Graphical elements might look different across displays on those systems.

Using Object Properties

These changes to object properties minimize the impact on your existing code and allow MATLAB to use the full display resolution when rendering graphical elements. All UIs you create in MATLAB are automatically DPI-aware applications.

Units Property

When you set the Units property of a graphics or UI object to 'pixels', the size of each pixel is now device-independent on Windows and Macintosh systems:

  • On Windows systems, 1 pixel = 1/96 inch.

  • On Macintosh systems, 1 pixel = 1/72 inch.

  • On Linux systems, the size of a pixel is determined by the display DPI.

Your existing graphics and UI code will continue to function properly with the new pixel size. Keep in mind that specifying (or querying) the size and location of an object in pixels might not correspond to the actual pixels on your screen.

For example, each screen pixel on a 192-DPI Windows system is 1/192nd of an inch. In this case, twice as many screen pixels cover the same linear distance as the device-independent pixels do. If you create a figure, and specify its size to be 500-by-400 pixels, MATLAB reports the size to be 500-by-400 in the Position property. However, the display uses 1000-by-800 screen pixels to cover the same graphical region.


Starting in R2015b, MATLAB might report the size and location of objects as fractional values (in pixel units) more frequently than in previous releases. For example, your code might report fractional values in the Position property of a figure, whereas previous releases reported whole numbers for that same figure.

Root ScreenSize Property

The ScreenSize property of the root object might not match the display size reported by high-DPI Windows systems. Specifically, the values do not match when the Units property of the root object is set to 'pixels'. MATLAB reports the value of the ScreenSize property based on device-independent pixels, not the size of the actual pixels on the screen.

Root ScreenPixelsPerInch Property

The ScreenPixelsPerInch property became a read-only property in R2015b. If you want to change the size of text and other elements on the screen, adjust your operating system settings.

Also, you cannot set or query the default value of the ScreenPixelsPerInch property. These commands now return an error:

The factory value cannot be queried either. This command returns an error as well:

Using print, getframe, and publish Functions

getframe and print Functions

When using the getframe function (or the print function with the -r0 option) on a high-DPI system, the size of the image data array that MATLAB returns is larger than in previous releases. Additionally, the number of elements in the array might not match the figure size in pixel units. MATLAB reports the figure size based on device-independent pixels. However, the size of the array is based on the display DPI.

publish Function

When publishing documents on a high-DPI system, the images saved to disk are larger than in previous releases or on other systems.

See Also