Screen Resolution Limit to Figure Size
Show older comments
I'd like to make a bit of code to create images targeted at a 4k display. Unfortunately, I don't own a 4k display. I do, however, have 3 1080 screens. Ordinarily I set them up in a row so my screen appears to MATLAB to be 1080 x 5760.
In this configuration if I run the below code with screen_fraction set to 1 or greater the images created are 1014 high (the maximum sized image always seems to have 66 fewer pixels than the apparent screen size).
If I tell Windows the displays are actually in a diagonal before starting MATLAB I can create a figure 2862 x 5088 before getting a java error.
Obviously then, MATLAB is limiting the figure size to the physical screen sizes but is capable of working with much bigger "displays."
The MonitorPositions and ScreenSize properties of get(groot) are read-only so I can't change them. Is there any other way to work around the connection to the physical size of the monitors?
Yes, I could use imwrite or print to work around this but I'd like to avoid that if possible.
Thanks in advance.
clearvars
screen_fraction = .5;
monitor_size = [1920 1080];
figure_pixels = fix(screen_fraction * monitor_size);
figure_offset = [1.25 0.25] .* monitor_size;
set(gcf,'units','pixels','Position',[figure_offset figure_pixels]);
% something to plot here
[XX,YY,ZZ] = peaks(25);
h = surf(XX,YY,ZZ);
F2I = frame2im(getframe(gcf));
target_size = fliplr(figure_pixels)
actual_size = size(F2I(:,:,1))
Accepted Answer
More Answers (0)
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!