How to change the color of my plots

조회 수: 2 (최근 30일)
Mojtaba Mohareri
Mojtaba Mohareri 2021년 9월 20일
댓글: Mathieu NOE 2021년 9월 21일
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
Simon Chan 2021년 9월 20일
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
  댓글 수: 1
Mojtaba Mohareri
Mojtaba Mohareri 2021년 9월 20일
Thank you very much for your help.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Mathieu NOE
Mathieu NOE 2021년 9월 20일
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
Mojtaba Mohareri
Mojtaba Mohareri 2021년 9월 21일
Hello. I really appreciate.
Mathieu NOE
Mathieu NOE 2021년 9월 21일
my pleasure

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Colormaps에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by