【发布时间】:2016-01-13 15:35:20
【问题描述】:
我正在尝试将这两个数字并排绘制。这个想法是在 x 轴上创建 1 到 10 的正方形图。我知道 subplot 功能,但有些它对我不起作用。非常感谢您的帮助。
% plotting the data
data1_plot=data1.*100;
data2_plot=data2.*100;
figure(1),
subplot(1,2,1);
plot((1:10)',mean(data1_plot),'o-','LineWidth',1);hold on
for ii=2:10;
if mean(data1_plot(:,ii))<mean(data1_plot(:,ii-1));
plot([ii-1,ii],mean(data1_plot(:,ii-1:ii)),'r.-');
end
end
set(gca,'XTickLabel',{'Unprofitable';'2';'3';'4';'5';'6';'7';'8';'9';'Profitable'});
axis([0.8,10.2,0.0,1.5]),...
ylabel('Average return'),...
title('\rm Equally-weighted PMU portfolio returns, 1990-2015');hold off;
subplot(1,2,2);
plot((1:10)',mean(data2_plot),'o-','LineWidth',1);hold on
for ii=2:10;
if mean(data2_plot(:,ii))<mean(data2_plot(:,ii-1));
plot([ii-1,ii],mean(data2_plot(:,ii-1:ii)),'r.-');
end
end
set(gca,'XTickLabel',{'Weak';'2';'3';'4';'5';'6';'7';'8';'9';'Robust'});
axis([0.8,10.2,0.0,1.5]),...
ylabel('Average return'),...
title('\rm Equally-weighted RMW returns, 1990-2015');hold off;
【问题讨论】:
-
您的情节链接看起来不错(除了格式不正确)您希望情节看起来像什么?你的描述很模糊。
-
绘图链接是输出。问题是,当我将下摆绘制成两个独立的图形时,我会得到两个非常整齐的正方形图形。但是,当我将绘图与 subplot 函数结合起来时,我会得到链接中给出的输出。我希望在不调整大小的情况下合并这两个地块