legend color does match with drawn lines?
Mostrar comentarios más antiguos
Hi,
I draw the plot and run the code but the legends color does not match with the line drawn? Does not Why, previously when i run the same code, it's showing perfectly fine but this time it's don't.
Can I changes the color code now or I have to run the codes again as it will take 12 hours to run the same code. The code i written for the plot are as follows:
fig3 = figure(3);
saveas(fig3,'BER.png');
semilogy(t,ber_fixed(1,:),'-ok','linewidth',2); hold on; grid on;
semilogy(t,ber_dynamic(1,:),'--ok','linewidth',2);
semilogy(t,ber_fixed1(2,:),'-o','linewidth',2); hold on;
semilogy(t,ber_dynamic1(2,:),'-+r','linewidth',2);
legend('Fixed user-1','Dynamic user-1','Fixed1 user-2','Dynamic1 user-2');
xlabel('No. of simulated positions(t_m)');
ylabel('Individual bit error rate (BER)');
axis([1 position 0 1]);
Please help me to resolve the issue, because donot know run same code will or will not show same mistake again.
1 comentario
Wan Ji
el 20 de Ag. de 2021
It's becuase you hold all the lines in the figure at the first run of your code, and later you run the code again, the two different colors may mix together to produce another color. What you need to do is just use clf right after the command figure.
fig3 = figure(3);
clf;
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Legend en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!