필터 지우기
필터 지우기

How do i make the background colour of my plot change in certain areas?

조회 수: 5 (최근 30일)
Nicki
Nicki 2013년 11월 25일
편집: Nicki 2013년 11월 25일
Hi, so I have this plot, it could be like this:
a=[[1:1440]'];
Totalset=[a a*0 (sin(a./20)+2)*100 a*0 cos(a./20)*9+20]
AX=plotyy(Totalset(:,1),Totalset(:,5),Totalset(:,1),Totalset(:,3))
set(AX(2),'ydir','rev')
hold on
set(get(AX(1),'Ylabel'),'String','Kernetemperatur(C)')
set(get(AX(2),'Ylabel'),'String','Dybde(m)')
y_venstre_min=10
y_venstre_max=30
y_hojre_min=50
y_hojre_max=300
set(AX(1),'YLim',[y_venstre_min,y_venstre_max])
set(AX(2),'YLim',[y_hojre_min,y_hojre_max])
And, now I have this matrix:
MTRX=[1 0 1 0 1 0 1 0;23 75 149 400 600 1100 1300 1400]'
I want my background to change to dark grey when MTRX(:,1)=1, and back to white when it goes back to 0 etc. So that my background would be white from 0 to 23, dark grey from 23 to 75, white from 75 to 149, dark grey from 149 to 400, and so on.
Is this possible, and do anyone have an example to help me get started I spent some time looking for this, but could only find how to change the colour of the entire background?
Best regards, Nicki Eriksen

채택된 답변

Image Analyst
Image Analyst 2013년 11월 25일
You'll probably need to use the patch() or fill() functions.
  댓글 수: 1
Nicki
Nicki 2013년 11월 25일
편집: Nicki 2013년 11월 25일
Yes, that should be possible, thanks for the hint, it's been like 3 years since I used those, so I completely forgot about them.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Two y-axis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by