Thread Subject: Filling the area between two curves

Subject: Filling the area between two curves

From: owen o'sullivan

Date: 26 Sep, 2009 15:57:02

Message: 1 of 3

I am trying to fill/shade the area between several groups of two lines on a time series graph. I am Using MatLab 7.7.0 (R2008b). Can anyone please help.
Owen

Subject: Filling the area between two curves

From: JS

Date: 8 Oct, 2009 13:47:05

Message: 2 of 3


Hi Group,

I am also having this problem/challenge:

On Sep 26, 5:57 pm, "owen o'sullivan" <om...@fsu.edu> wrote:
> I am trying to fill/shade the area between several groups of two lines on a time series graph. I am Using MatLab 7.7.0 (R2008b). Can anyone please help.
> Owen

It must be possible. I've tried plotting two area() graphs in the same
axis and coloring the face of the lower one white, but it doesn't look
good and it is a hack.. Anybody have any ideas?

Thanks!

/J

Subject: Filling the area between two curves

From: Nabanita

Date: 25 Nov, 2009 14:35:19

Message: 3 of 3

Hi,
 I think this works.
y = [0:0.2:10];
x1 = y.^2+2;
x2 = 3*y-3;
% The variable with higher y value should be plotted first. For more complex situation plot all the
% curves first to check which one has higher y values
figure
h2 = area(x2,y,'FaceColor',[.5 .9 .6],'EdgeColor','b', 'LineWidth',2);
% plot the x2 and x1 variables. x2 variable is marked by blue line
hold on
h1 = area(x1,y,'FaceColor',[.9 .85 .7],'EdgeColor','y','LineWidth',2);
hold off
% The area between x2 and x1 variable is shaded green and the area between
% x =0 and x1 variable is shaded brown.
% The problem with this code is that you can set any transparency because
% it is actually shading the area between x2 and x =0 and then x1 and x = 0.

Nita
JS <joe778899@gmail.com> wrote in message <c8735d82-721d-4e89-8ae9-ecdb9175ba57@h30g2000vbr.googlegroups.com>...
>
> Hi Group,
>
> I am also having this problem/challenge:
>
> On Sep 26, 5:57?pm, "owen o'sullivan" <om...@fsu.edu> wrote:
> > I am trying to fill/shade the area between several groups of two lines on a time series graph. I am Using MatLab 7.7.0 (R2008b). Can anyone please help.
> > Owen
>
> It must be possible. I've tried plotting two area() graphs in the same
> axis and coloring the face of the lower one white, but it doesn't look
> good and it is a hack.. Anybody have any ideas?
>
> Thanks!
>
> /J

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
curves Nabanita 25 Nov, 2009 09:39:42
area Nabanita 25 Nov, 2009 09:39:42
filling Nabanita 25 Nov, 2009 09:39:41
curve Sprinceana 27 Sep, 2009 09:51:03
2 curves Sprinceana 27 Sep, 2009 09:51:03
area Sprinceana 27 Sep, 2009 09:51:03
fill Sprinceana 27 Sep, 2009 09:51:03
fill area Sprinceana 27 Sep, 2009 09:51:03
rssFeed for this Thread

Contact us at files@mathworks.com