Shade area between two vertical lines
<p>I have data for 12 time points  <code>y1=[.61 .52 .45 .75 .76 .79 .82 .6 .66 .54 .43 .21];</code> I would like to plot this as a line plot and draw two vertical line at time point 7 and 8 and shade the area in between these two lines. This shaded area should be transparent enough to still show the line. I would also like to have a legend to show that shaded area = critical period or have "critical period" written within the area underneath the line. From this <a href="https://stackoverflow.com/questions/6245626/matlab-filling-in-the-area-between-two-sets-of-data-lines-in-one-figure">answer</a>, I've tried: </p>

<pre><code>y1=[.61 .52 .45 .75 .76 .79 .82 .6 .66 .54 .43 .21];
N=size(y1,2);
sky_blue = [0, 0, 1] ;
x=1:N;           
plot([1:N]', y1, 'linewidth', 2.8, 'linestyle', '-', 'color', sky_blue);
hold on
x1=7;
x2=8;
y2=get(gca,'ylim');    
plot([x1 x1],y2)
plot([x2 x2],y2)    
h1 = fill(x1,x2,'b','EdgeColor','none');
</code></pre>

<p>The issue is that things are okay until the last line with which I can't get the shading between the two lines. Can anyone help?</p>