Is it possible to get axis size in px units if it is created in normalized units?
25 次查看(过去 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!