Fill areal between graphs

3 visualizaciones (últimos 30 días)
Eivind Jamessen
Eivind Jamessen el 28 de Mzo. de 2020
Respondida: Subhamoy Saha el 28 de Mzo. de 2020
Hi
I have to graphs, which is created by two vectors with elements. I want to fill the area between the red and blue graph, but only where red graph has higher value than blue.
h = 1:24;
plot(h,P_loadSEKK2,'r')
hold on
plot(h,TOT_worstDAY)
legend('Load','Grid+Sun')
hold off
Can someone fill in a suggestion?

Respuestas (1)

Subhamoy Saha
Subhamoy Saha el 28 de Mzo. de 2020
This may help you
x = -pi:pi/10:pi;
y=sin(x);
y2=0.8*y;
area(x,y,'Facecolor','r')
hold on
area(x,y2,'Facecolor',[1 1 1])
hold off
For more help please see
doc area

Categorías

Más información sobre Graph and Network Algorithms en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by