# How to change the color of my plots

1 view (last 30 days)
Mojtaba Mohareri on 20 Sep 2021
Commented: Mathieu NOE on 21 Sep 2021
Hello everone,
I've plot my figure in matlab as follows
close all
clear all
avalues=0.3:0.01:1;
N=8000;
d=0.03;
a=avalues;
x=0.78;
y=0.81;
X=zeros(N,length(a));
Y=zeros(N,length(a));
for n=1:0.3*N
x=(1-d).*x.*exp(a.*(1-x).*((x/0.2)-1))+d.*y.*exp(a.*(1-y).*((y/0.2)-1));
y=(1-d).*y.*exp(a.*(1-y).*((y/0.2)-1))+d.*x.*exp(a.*(1-x).*((x/0.2)-1));
X(n,:)=x;
Y(n,:)=y;
end
figure (9), hold on
for n=.3*N:N
x=(1-d).*x.*exp(a.*(1-x).*((x/0.2)-1))+d.*y.*exp(a.*(1-y).*((y/0.2)-1));
y=(1-d).*y.*exp(a.*(1-y).*((y/0.2)-1))+d.*x.*exp(a.*(1-x).*((x/0.2)-1));
X(n,:)=x;
Y(n,:)=y;
plot(a,x,'.','MarkerSize',0.01)
hold on
plot(a,y,'.','MarkerSize',0.01)
axis([0.3 1 -1 1.4])
end
hold off
The output is
As we can seen, I have two figures on each other.
How can I change its color to the colors something like this?

Simon Chan on 20 Sep 2021
Just put the color code for the markers. May try the following:
for n=.3*N:N
x=(1-d).*x.*exp(a.*(1-x).*((x/0.2)-1))+d.*y.*exp(a.*(1-y).*((y/0.2)-1));
y=(1-d).*y.*exp(a.*(1-y).*((y/0.2)-1))+d.*x.*exp(a.*(1-x).*((x/0.2)-1));
X(n,:)=x;
Y(n,:)=y;
plot(a,x,'r.','MarkerSize',0.01)
hold on
plot(a,y,'b.','MarkerSize',0.01)
axis([0.3 1 -1 1.4])
end
Mojtaba Mohareri on 20 Sep 2021
Thank you very much for your help.

Mathieu NOE on 20 Sep 2021
hello
I modified a bit your code to get this result :
.code :
close all
clear all
avalues=0.3:0.005:1;
N=200;
d=0.03;
a=avalues;
x=0.78;
y=0.81;
X=zeros(N,length(a));
Y=zeros(N,length(a));
for n=1:0.3*N
x=(1-d).*x.*exp(a.*(1-x).*((x/0.2)-1))+d.*y.*exp(a.*(1-y).*((y/0.2)-1));
y=(1-d).*y.*exp(a.*(1-y).*((y/0.2)-1))+d.*x.*exp(a.*(1-x).*((x/0.2)-1));
X(n,:)=x;
Y(n,:)=y;
end
figure (9), hold on
for n=.3*N:N
x=(1-d).*x.*exp(a.*(1-x).*((x/0.2)-1))+d.*y.*exp(a.*(1-y).*((y/0.2)-1));
y=(1-d).*y.*exp(a.*(1-y).*((y/0.2)-1))+d.*x.*exp(a.*(1-x).*((x/0.2)-1));
X(n,:)=x;
Y(n,:)=y;
plot(a,x,'r.','MarkerSize',15)
hold on
plot(a,y,'b.','MarkerSize',15)
end
axis([0.3 1 0 1.5])
hold off
##### 2 CommentsShowHide 1 older comment
Mathieu NOE on 21 Sep 2021
my pleasure