Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.


Curious
Posts:
2,357
Registered:
12/6/04


Re: Filling the area between two curves
Posted:
Apr 3, 2013 1:04 PM


"Andrea " <ruecker.andrea@gmail.com> wrote in message <kjhk3k$prs$1@newscl01ah.mathworks.com>... > "Nabanita " <nabanitag@gmail.com> wrote in message <hejfb7$ouh$1@fred.mathworks.com>... > > Hi, > > I think this works. > > y = [0:0.2:10]; > > x1 = y.^2+2; > > x2 = 3*y3; > > % 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 <c8735d82721d4e898ae9ecdb9175ba57@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 > > > I have kind of the same problem and could not get to a solution yet. > I have two vectors with min and max values of a data set, I would like to show the variance by shading these interval. (also plotting the mean). > > This message is always occurring : > > >>Subscript indices must either be real positive integers or logicals. > > When I tried fill() or area() ... and tried also this code: > > http://stackoverflow.com/questions/6245626/matlabfillingintheareabetweentwosetsofdatalinesinonefigure > ...where it does not like the baseLine function ... > > Can anyone give a solution to fill the area within the curves?!
% Have you tried:
doc area
% It seems to be exactly the command you are looking for. % Lookl at the Examples section in the help.



