Is it possible to get axis size in px units if it is created in normalized units?
20 ビュー (過去 30 日間)
古いコメントを表示
採用された回答
Jan
2018 年 3 月 26 日
編集済み: Jan
2018 年 3 月 26 日
set(gcf, 'units', 'normalized', 'position', [0 0 1 1]);
AxesH = axes('units', 'normalized', 'position', [0 0 1 1]);
drawnow; % !!!!!
backUnits = get(AxesH, 'units');
set(AxesH, 'Units', 'pixels')
pixPos = get(AxesH, 'Position');
set(AxesH, 'Units', backUnits);
Without the drawnow I get my full monitor resolution, although Matlab crops the height to display the upper part of the border and the menu bar. What a pity.
A simpler method with a built-in Matlab function:
pixPos = getpixelposition(AxesH)
1 件のコメント
Jan
2018 年 3 月 27 日
By the way: When I ask an internet search engine for "Matlab get axes position in pixels", the documentation of getpixelposition is the first hit.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Interactive Control and Callbacks についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!