Problems with printing figures resulting in cutting off of subplots, images (Matlab 2014b)
8 ビュー (過去 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 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Subplots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!