getpixelposition vs OuterPosition of figure
10 次查看(过去 30 天)
显示 更早的评论
I'm getting different values from getpixelposition and the OuterPosition of the figure ...
get(gcf,'OuterPosition')
ans =
3062 537 2201 801
>> getpixelposition(gcf)
ans =
3070 545 2185 708
>> get(gcf,'Position')
ans =
3070 545 2185 708
What gives? Why is there an 8 pixel discrepancy on each side?
Edit: I added 'Position' to show that this is the same as getpixelposition when units are pixels per Luna's comment. Note that Position is larger than OuterPosition for all properties except the height ...
0 个评论
采纳的回答
Image Analyst
2018-11-27
The larger one probably includes the operating system borders of the figure, while the smaller one does not include the border. That's my guess.
更多回答(1 个)
Luna
2018-11-27
编辑:Luna
2018-11-27
Hi Jim,
I generally set 'units' property as 'normalized' for all figures and uicontrol elements in my codes.
Even the screen resolution changes from one monitor to another the position of your figure window appears in the same position.
get(gcf,'Position') equals to getpixelposition(gcf).
If you use OuterPosition you will get different value.
Position and OuterPosition are different things. Check below to see Position, InnerPosition & OuterPosition.
Also check below link Jan has written:
6 个评论
Image Analyst
2018-11-27
But Position (the red line) is inside the Outerposition (blue) so why do you say that? If it's inside the blue, then the outer coordinates of the blue line should take it into account.
另请参阅
类别
在 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!