No difference between font size units 'pixels' and 'points'
古いコメントを表示
I noticed when changing the font size of a figure it makes no difference if one chooses pixels or points as units. Is this a known issue or intended?
figure(1)
set(gcf,'Position',[10 10 800 800])
peaks;
fontsize(16,'pixels')
figure(2)
set(gcf,'Position',[10 10 800 800])
peaks;
fontsize(16,'points')


left: figure 1, font size = 16 px; right: figure 2, font size = 16 pt; created using MATLAB Desktop
Interestingly, creating the same figures using the code above in the New Desktop for MATLAB produces 33% bigger font sizes given in points compared to pixels (consistent with the points/pixels size conversion).


left: figure 1, font size = 16 px; right: figure 2, font size = 16 pt; created using New Desktop for MATLAB
5 件のコメント
Epsilon
2024 年 9 月 20 日
Hi Jakob,
I could not reproduce this issue in R2024b. I am getting distinct sizes.

Is there something I am missing ?
Bruno Luong
2024 年 9 月 20 日
編集済み: Bruno Luong
2024 年 9 月 20 日
"Pixels.
Starting in R2015b, distances in pixels are independent of your system resolution on Windows and Macintosh systems:
- On Windows systems, a pixel is 1/96th of an inch.
- On Macintosh systems, a pixel is 1/72nd of an inch.
On Linux systems, the size of a pixel is determined by your system resolution."
'points'Points. One point equals 1/72nd of an inch.
So On Windows 1 pixel = 72/96 = 0.75 point (test match on my PC), or 1 point = 1.333 pixel.
The code in the question has font larger on the second figure on my PC as well, as expected.
On Mac pixel = 72/72 = 1 point


Jakob Weis
2024 年 9 月 20 日
Bruno Luong
2024 年 9 月 22 日
Perhaps the New Desktop redefines the pixel unit differently. I don't know New Desktop myself.
Jakob Weis
2025 年 2 月 7 日
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Startup and Shutdown についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!