Problems using hold on when plot figure

조회 수: 1 (최근 30일)
Tam Ho
Tam Ho 2018년 3월 12일
답변: Santosh Prasad Choudhury 2018년 3월 12일
My code
colors = repmat('krgbmc',1,300) ;
Rtot =20;
L = 0:0.01:200 ;
KDs = 10:20:90 ;
figure
hold on
for i=1:length(KDs)
KD = KDs(i) ;
LR = Rtot*L./(L + KD) ;
LR_all(i,:) = LR ;
figure
hold on
plot(L,LR,colors(i)) ;
figurelegend(i) = ['K_D = ', int2str(KD),'uM'];
end
xlabel('[Ligand] (uM)')
ylabel('[Ligand-Receptor] (uM)')
legend(figurelegend,'Location','SouthEast')
  댓글 수: 1
Walter Roberson
Walter Roberson 2018년 3월 12일
What difficulty do you observe?
You are asking to create a new figure for each plot. Is that your intent?

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

채택된 답변

Santosh Prasad Choudhury
Santosh Prasad Choudhury 2018년 3월 12일
Please replace your code by figurelegend{i} = ['K_D = ', int2str(KD),'uM']; and you are creating somany figures? Please let me know your intention.
  댓글 수: 1
Tam Ho
Tam Ho 2018년 3월 12일
Works perfectly. Thanks! I wanted all plots on one graph.

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

추가 답변 (1개)

Santosh Prasad Choudhury
Santosh Prasad Choudhury 2018년 3월 12일
colors = repmat('krgbmc',1,300) ; Rtot =20; L = 0:0.01:200 ; KDs = 10:20:90 ; figure hold on for i=1:length(KDs) KD = KDs(i) ; LR = Rtot*L./(L + KD) ; LR_all(i,:) = LR ; plot(L,LR,colors(i)) ; figurelegend{i} = ['K_D = ', int2str(KD),'uM']; end xlabel('[Ligand] (uM)') ylabel('[Ligand-Receptor] (uM)') legend(figurelegend,'Location','SouthEast')
Please use above code and you will get your answer.

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by