Figure のサイズを変更するにはどうしたらよいですか?
Show older comments
Figure のサイズを変更しようとしています。以下の例では、figure(2)のサイズを変更することを期待していました。そのために次のコードを追加しましたが、うまくいきません。なぜでしょうか?
set(gcf, 'PaperUnits', 'inches');
set(gcf, 'PaperSize', [4 2]);
set(gcf, 'PaperPositionMode', 'manual');
set(gcf, 'PaperPosition', [0 0 4 2]);
clc;
clear all;
t = 0:.1:4*pi;
y = sin(t);
figure(1)
set(gcf, 'renderer', 'painters');
plot(t,y)
xlabel('Time(s)')
ylabel('y(t)')
title('Sin function')
legend('y=sin(t)')
axis([0 t(end) -1.5 1.5])
set(gca, 'Units', 'normalized', 'YTick', -1.5:.5:1.5, 'XTick', 0:t(end)/4:t(end), 'FontUnits', 'points', 'FontWeight', 'normal', 'FontSize', 9, 'FontName', 'Times')
set(gca, 'Position', get(gca, 'OuterPosition') - get(gca, 'TightInset') * [-1 0 1 0; 0 -1 0 1; 0 0 1 0; 0 0 0 1]);
figure(2)
set(gcf, 'renderer', 'painters');
set(gcf, 'PaperUnits', 'inches');
set(gcf, 'PaperSize', [4 2]);
set(gcf, 'PaperPositionMode', 'manual');
set(gcf, 'PaperPosition', [0 0 4 2]);
plot(t,y)
xlabel('Time(s)')
ylabel('y(t)')
title('Sin function')
legend('y=sin(t)')
axis([0 t(end) -1.5 1.5])
set(gca, 'Units', 'normalized', 'YTick', -1.5:.5:1.5, 'XTick', 0:t(end)/4:t(end), 'FontUnits', 'points', 'FontWeight', 'normal', 'FontSize', 9, 'FontName', 'Times')
set(gca, 'Position', get(gca, 'OuterPosition') - get(gca, 'TightInset') * [-1 0 1 0; 0 -1 0 1; 0 0 1 0; 0 0 0 1]);
Accepted Answer
More Answers (0)
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!