Borrar filtros
Borrar filtros

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

5 visualizaciones (últimos 30 días)
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

Respuesta aceptada

Image Analyst
Image Analyst el 25 de Nov. de 2013
You'll probably need to use the patch() or fill() functions.
  1 comentario
Nicki
Nicki el 25 de Nov. de 2013
Editada: Nicki el 25 de Nov. de 2013
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.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Two y-axis en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by