フィルターのクリア

Subplots shrink when I save the figure

9 ビュー (過去 30 日間)
MINA
MINA 2017 年 2 月 15 日
編集済み: Yifan Gu 2017 年 2 月 16 日
I have 12 subplots in a figure and when I am trying to save the figure as .png or .jpg with a command line then the subplots shrink but when I am using the save button on the figure window then it saves it fine. Any help would be appreciated.

回答 (1 件)

Yifan Gu
Yifan Gu 2017 年 2 月 16 日
編集済み: Yifan Gu 2017 年 2 月 16 日
% The following example shows how to control the figure sizes and fontsizes of the figures saved by matlab. As a result, the saved figures, when opend else where, will look exactly like they appeared on your screen when first generated in matlab.
% Yifan Gu, Sep 2016, yigu8115@gmail.com
figure_width = 8.4; %cm
figure_hight = 15; %cm
figure('NumberTitle','off','name', 'figure_size_control', 'units', 'centimeters', 'color','w', 'position', [0, 0, figure_width, figure_hight], 'PaperSize', [figure_width, figure_hight]); % this is the trick!
plot(1:10)
text(2.5,2,{'The figure size should',' be 8.4 by 15 cm'})
set(gca,'FontSize', 20); % 6 points for x-axis tickmark labels
xlabel('30 point label', 'fontsize', 30 ); % this must be after the above line!
set(gcf, 'PaperPositionMode', 'auto'); % this is the trick!
print -depsc figure_size_control % this is the trick!!

カテゴリ

Help Center および File ExchangeAxis Labels についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by