I think matlab plot position code is incorrect, the plot position values output are not right...help!?
3 views (last 30 days)
Show older comments
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
0 Comments
Answers (0)
See Also
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!