figure - Change Legend diagram in matlab -
i have code this:
for = 1:length(reliabilitystruct) if (failureflags(i) == 0) plot(x(i), y(i), '.b'); elseif (failureflags(i) == 1) plot(x(i), y(i), 'or'); elseif (failureflags(i) == 2) plot(x(i), y(i), 'og'); elseif (failureflags(i) == 3) plot(x(i), y(i), 'ok'); else fprintf('\nunknown flag, check data\n') homecoming end end drawnow; legend('recovery', '1', '2', '3');
so aim create graph has different symbols different flags. see below:
as can see, legend doesn't fit data. how can alter each of legend entries prepare up? alternatively, there improve way approach this?
i think can utilize (added bonus avoid loops!):
ind = failureflags==0; plot(x(ind), y(ind), '.b'); ind = failureflags==1; plot(x(ind), y(ind), 'or'); ind = failureflags==2; plot(x(ind), y(ind), 'og'); ind = failureflags==3; plot(x(ind), y(ind), 'ok'); legend('recovery', '1', '2', '3');
matlab figure
No comments:
Post a Comment