How do i make the background colour of my plot change in certain areas?
5 views (last 30 days)
Show older comments
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
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Two y-axis 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!