Is it possible to get axis size in px units if it is created in normalized units?
조회 수: 12 (최근 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에서 Graphics Performance에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!