1

I'm trying (without success so far) to colorize or to shade the surface between two curves but that are in the vertical direction. More specifically, I'd like to shade the surface between the red and the blue curves, knowing that they sometimes cross each others.

The final purpose of this is to show the domain of incertitude (the nominal curve is the black one), represented by the red and the blue curves.

I don't know if that can help, I have for each curve a vector of 100 values. Do you have any idea on how to do this ?

Image

Thanks a lot,

Best regards,

Antoine

Edit : Thanks for the quick answer !

I tried with your method but it doesn't seem to work unfortunately..

Here's my code :

filename = '/Users/Antoine/Dropbox/TFE/Post-processing/100planes_Z_HT/case1/HT_tip_int.dat';
delimiterIn = ' ';
case1_int = importdata(filename,delimiterIn);

filename = '/Users/Antoine/Dropbox/TFE/Post-processing/100planes_Z_HT/case4/HT_tip_int.dat';
delimiterIn = ' ';
case4_int = importdata(filename,delimiterIn);

filename = '/Users/Antoine/Dropbox/TFE/Post-processing/100planes_Z_HT/case5/HT_tip_int.dat';
delimiterIn = ' ';
case5_int = importdata(filename,delimiterIn);

figure
HT_tip_int1=plot(case1_int.data,Z2,'k-','Linewidth',1);
hold on;
HT_tip_int4=plot(case4_int.data,Z2,'r');
HT_tip_int5=plot(case5_int.data,Z2,'c');

area( [case4_int.data fliplr(case5_int.data)], [Z2 fliplr(Z2)],'FaceColor','red'); hold off

It is the right way to do it ?

Thanks for your help !

Antoine

beresfordt
  • 5,088
  • 10
  • 35
  • 43
ant1684
  • 11
  • 2
  • Some clever answers [here](http://stackoverflow.com/questions/19910982/matlab-fill-area-between-lines) too. – chappjc Mar 11 '14 at 04:31

1 Answers1

1

How about using area the following way:

Take the first dataset and it's argument vector, and concatenate it with the second dataset backwards. That way you get a closed polygon.

% example data
t  = 1:100;
x1 = sin(pi*t/10).*t
x2 = 0.1*sin(pi*t/10).*t*2 + 25

plot(x1,t, x2, t,'linewidth',5); hold on
area( [x1 x2(end:-1:1)], [t t(end:-1:1)],'FaceColor','red'); hold off
% or
% area( [x1 fliplr(x2)], [t fliplr(t)],'FaceColor','red'); hold off

gives:

enter image description here

Robert Seifert
  • 25,078
  • 11
  • 68
  • 113