How and why Matlab defines maximal values for gcf's position (width and height)? It looks like these values are screen resolution dependent ...
1 次查看(过去 30 天)
显示 更早的评论
If I run subroutine which outputs a figure on 12,5" laptop (screen resolution 1366x768) with the following gcf settings:
set(gcf, 'Units','pixels ','Position',[0 0 1500 1500]);
then Matlab automatically cuts the figure position (width and height) to [0 0 1366 698].
This causes problems already on the screen and then also when gcf is exported to file (saveas(gcf,filename,'pdf');). As the subroutine is being used on different computers, the generated output figure is not identical. In case of 12,5" laptop, the figure is not recognizable ...
What shall I do to avoid this problem?
Thanks, Janez
2 个评论
Albert Yam
2012-7-25
Does it have to do with the figure that is being opened/created? If I run
figure;plot(1:10)
set(gcf, 'Units','pixels','Position',[0 0 3000 3000]);
The figure window is bigger than my screen, but it doesn't get chopped off. (I have to right click the start bar > move to get it to show.)
回答(3 个)
Daniel Shub
2012-7-25
Instead of using units of pixels, use normalized units. This way you do not have to worry about making figures larger than the screen size.
2 个评论
Daniel Shub
2012-8-3
Why don't you edit your question to include some example code that demonstrates the problem and lists all of the requirements.
Leah
2012-7-25
figure;plot(1:10)
set(gcf, 'Units','normalized','Position',[0 0 1 1]); %fullscreen
position is a percentage of your screen, instead of pixels
1 个评论
Image Analyst
2012-8-3
I think he knows that. His problem is that when he goes to save an file, it saves it as the current max screen resolution, and then when that image is recalled, it looks weird on other computers with different resolution than his.
Image Analyst
2012-8-3
Janez, have you tried export_fig? http://matlab.wikia.com/wiki/FAQ#How_do_I_save_my_figure.2C_axes.2C_or_image.3F_I.27m_having_trouble_with_the_built_in_MATLAB_functions.
It lets you specify an exact resolution for your output image. I haven't tried to do this, but see what happens if you specify a resolution larger than your screen. See if it gets saved out with that larger resolution, or if it limits it to your screen's resolution. Let us know how it works.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!