I think matlab plot position code is incorrect, the plot position values output are not right...help!?
2 ビュー (過去 30 日間)
古いコメントを表示
i need help, this code completely replicates my problem. is this an issue with just my computer? version of matlab? Or do I have a fundemental misunderstanding about what these numbers mean. I understand them to be in order, units away from the bottom left corner x dim, then y dim, then width and height. Help please
h = figure
plot(rand(10, 1))
h.Units= 'pixels';
h.Position = [3.2394e+03 524.2000 496.8000 340.8000]
%or if you dont have 2 monitors
h.Position (1:2) = 100
axis square
% the numbers I got from the pictures uploaded using autohotkey to measure pixels are below
% I also measured using come calipers and the axes are the same size IRL which is consistant with
% autohotkey and 'axis square'
BL = [1188, 1053];
BR = [1536, 1051];
TL = [1189, 705];
xLengthPx = BR(1) - BL(1)
yLengthPx = BL(2) - TL(2)
xLengthPx =
348
yLengthPx =
348
plotSize = getpixelposition(gca)
plotSize =
65.5840 38.4880 385.0200 277.7520 % the output in pixels are nowhere near the real values
plotSize = plotboxpos(gca) % on file exchange
plotSize =
0.2380 0.1100 0.5591 0.8150 % the ratios of x and y lengths are nowhere near 1 as they
%should be
![IMG_6950.jpg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/249327/IMG_6950.jpeg)
![IMG_6951.jpg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/249328/IMG_6951.jpeg)
![IMG_6952.jpg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/249329/IMG_6952.jpeg)
0 件のコメント
回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!