MATLAB: How to put in color a certain part of the background in a plot with matlab

backgroundplot

Hello,
I would like to draw in grey color a certain part of the background in a plot. I know how to change the background color of the whole plot.I used this code after the plot function:
HANDLE = gca
get( HANDLE );
set( HANDLE, 'Color', [0.7,0.7,0.7] )
Exemple: y=x^2
How can I do to draw the blue part in grey and to leave the other parts in white?

Best Answer

Try rectangle. First, draw the rectangle, then the line plots (using hold on, of course).
Related Question