Clear Filters
Clear Filters

How to add different shaded Color to the back ground of a graph?

26 views (last 30 days)
a = 0:0.1:2*pi;
b = sin(a);
i have written a simple code of sin wave.. i want to add diffrent background colours to different regions or bands.. for example 0-2 some colour, 2-4 some other colour.. as shown in a picture added with this question.
i have tried "area" & "Fill" function but not getting desired results.

Accepted Answer

Image Analyst
Image Analyst on 15 Aug 2023
Try fill or patch

More Answers (0)


Find more on 2-D and 3-D Plots in Help Center and File Exchange





Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!