Problems with printing figures resulting in cutting off of subplots, images (Matlab 2014b)

19 次查看(过去 30 天)
While working on a work desktop, I was creating a series of subplot-heavy graphs that ended up by chance having the perfect size when maximized on that desktop, resulting in me doing a lazy hack and defining size with setting the OuterPosition to [0 0 1 1] (normalized). Unfortunately, I'm now using a laptop with a much smaller screen size, which, with the same code, scrunches the graphs such that they are unusable. I've been trying to get around this through various methods, all of which have failed in the following ways:
1) All subplots outside of the window dimensions were cut off, both in the GUI and when printing to .eps. This I attempted fixed by changing the PaperPositionMode away from manual (to at least fix the print issue), but then...
2) Running the code produces an incredibly zoomed in (seemingly randomly positioned) fraction of the entire plot, and only that
Here's a super shortened bit of my code that seems to reproduce the issue (I have additionally been messing around with all sorts of values in Position, OuterPosition, etc. without success):
%Create figure
figure1 = figure('units','pixels');
%Get current and wanted screen size
scrsz = get(groot,'ScreenSize');
pixelsy = 1440; %Screen size of the desktop, size I want for graph
pixelsx = 2560;
% Insert graphing code here, sample:
model_vars_subscripts = (1:3*6);
model_vars_subscripts = reshape(model_vars_subscripts,[3 6])';
for i=1:6
for j = 1:3
subplot(6,3,model_vars_subscripts(i,j))
plot(rand(10,1),rand(1,10),'or')
end
end
%Set figure into position
figure1.OuterPosition = [40 scrsz(4)-pixelsy-70 pixelsx pixelsy]; %Offset so the top of the window isn't above the screen
figure1.Position = [40 scrsz(4)-pixelsy-70 pixelsx pixelsy];
figure1.PaperPoisitonMode = 'manual';
figure1.PaperPosition = [0 0 pixelsx pixelsy];
%Print figure
filenameS = 'subplot_eps_test';
print(gcf,'-depsc2','-loose',filenameS);
In the end, all what I want is to set the image size to an arbitrary size (i.e. 2560 x 1440 px), since these plots are to hold a lot of points and become illegible at smaller sizes.
Thank you in advance for your help!
  3 个评论
ks905383
ks905383 2016-2-25
Ahh, good to know.
Turns out PaperUnits were still set to inches; I didn't know specifying figure units would not convert PaperUnits as well (but it might also be because 'pixels' are somehow acceptable as figure units, but not as paper units). Graphs are getting made fine now.
Thank you very much for the help!

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by