Legend function shows wrong colors.
Show older comments
Hi, i want to plot my curves with respect to time. However legend function assigns wrong color values to wrong colors. That is, it does not name them with the order gave to it.
Thanks for the help!
clc
clear all
close all
k_a=1/8;
k_b=0.2;
k_c=4;
k_g=0.1;
k_w=0.2;
h=0.2;
ti=0;
tf=100;
T=ti:h:tf;
S=zeros(length(T));
E=zeros(length(T));
I=zeros(length(T));
M=zeros(length(T));
R=zeros(length(T));
%%Some code.
plot(T,S)
hold on
plot(T,E)
hold on
plot(T,I)
hold on
plot(T,M)
hold on
plot(T,R)
hold on
legend('Suceptibles','Exposed','Infected','Medicaly Semptomatic','Recovered')
2 Comments
Adam
on 11 Jan 2021
It would help if you posted the result of doing all that so we can see what the legend looks like. It seems fine to me when I run it.
Oguz Munib Esen
on 11 Jan 2021
Accepted Answer
More Answers (0)
Categories
Find more on Legend in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!