Reputation: 153
I'm trying to plot the two figures next to each other. The idea is to create square plots with 1 to 10 on the x-axis. I'm aware of the subplot function but some how it's not working for me. Help is greatly appreciated.
% 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;
Upvotes: 0
Views: 2183