Error in legends of subplots using a for loop
I want legends g_1=fr(1), g_1=fr(2), g_1=fr(3) for each plots in each window ha(kk). I am doing some mistake in legends, but couldn’t figured it out. Any suggestions please. Thanks.
[ha, pos]= tight_subplot(4,3,[.1 .15],[.13 .01],[.13 .1]);
fr=([0.1, 0.5, 1]);
[h0, h1]=size(fr);
% for jj=1:h1
for jj=1:3
for kk=1:12
lin={‘–‘,’-.’,’:’};
axes(ha(kk));
x=load(sprintf(‘frq_%d%d.dat’,jj,kk));
x1(jj)=loglog(x(:,33),x(:,kk+5),’linestyle’,lin{jj},’LineWidth’, 2.5);
hold on
ylabel([ha(1),ha(4), ha(7),ha(10)],’Deltaomega_{}’)
xlabel([ha(10), ha(11),ha(12)],’Deltaomega_{o}’)
% legend([x1([1 2 3])],{‘$g_1=fr(%d)$’,jj},’Fontsize’,34,’Location’,’northwest’,’Interpreter’, ‘latex’);
legend([x1([jj])],{‘rm{"$g_1{‘+fr{jj}+’}$"}’},’Fontsize’,34,’Location’,’northwest’,’Interpreter’, ‘latex’);
legend(‘boxoff’)
end
endI want legends g_1=fr(1), g_1=fr(2), g_1=fr(3) for each plots in each window ha(kk). I am doing some mistake in legends, but couldn’t figured it out. Any suggestions please. Thanks.
[ha, pos]= tight_subplot(4,3,[.1 .15],[.13 .01],[.13 .1]);
fr=([0.1, 0.5, 1]);
[h0, h1]=size(fr);
% for jj=1:h1
for jj=1:3
for kk=1:12
lin={‘–‘,’-.’,’:’};
axes(ha(kk));
x=load(sprintf(‘frq_%d%d.dat’,jj,kk));
x1(jj)=loglog(x(:,33),x(:,kk+5),’linestyle’,lin{jj},’LineWidth’, 2.5);
hold on
ylabel([ha(1),ha(4), ha(7),ha(10)],’Deltaomega_{}’)
xlabel([ha(10), ha(11),ha(12)],’Deltaomega_{o}’)
% legend([x1([1 2 3])],{‘$g_1=fr(%d)$’,jj},’Fontsize’,34,’Location’,’northwest’,’Interpreter’, ‘latex’);
legend([x1([jj])],{‘rm{"$g_1{‘+fr{jj}+’}$"}’},’Fontsize’,34,’Location’,’northwest’,’Interpreter’, ‘latex’);
legend(‘boxoff’)
end
end I want legends g_1=fr(1), g_1=fr(2), g_1=fr(3) for each plots in each window ha(kk). I am doing some mistake in legends, but couldn’t figured it out. Any suggestions please. Thanks.
[ha, pos]= tight_subplot(4,3,[.1 .15],[.13 .01],[.13 .1]);
fr=([0.1, 0.5, 1]);
[h0, h1]=size(fr);
% for jj=1:h1
for jj=1:3
for kk=1:12
lin={‘–‘,’-.’,’:’};
axes(ha(kk));
x=load(sprintf(‘frq_%d%d.dat’,jj,kk));
x1(jj)=loglog(x(:,33),x(:,kk+5),’linestyle’,lin{jj},’LineWidth’, 2.5);
hold on
ylabel([ha(1),ha(4), ha(7),ha(10)],’Deltaomega_{}’)
xlabel([ha(10), ha(11),ha(12)],’Deltaomega_{o}’)
% legend([x1([1 2 3])],{‘$g_1=fr(%d)$’,jj},’Fontsize’,34,’Location’,’northwest’,’Interpreter’, ‘latex’);
legend([x1([jj])],{‘rm{"$g_1{‘+fr{jj}+’}$"}’},’Fontsize’,34,’Location’,’northwest’,’Interpreter’, ‘latex’);
legend(‘boxoff’)
end
end plotting, subplot, legend, for loop MATLAB Answers — New Questions