Highlight Region of Sine Graph

10 views (last 30 days)
I have a sine graph and I want to highlight all along the x-axis and just the [-1,1] region on the y-axis. Is this possible?
This is my code and I would like the bounds between [-1,1] on the y-axis to be shaded some color all along the x-axis. The whole area, not just the peaks and valleys.

Accepted Answer

Asad (Mehrzad)  Khoddam
Asad (Mehrzad) Khoddam on 16 Oct 2020
% Do you want this?
x=linspace(0,2*pi,101);
y=sin(x);
area(x,y)
  5 Comments
birdnerd007
birdnerd007 on 16 Oct 2020
Amazing! Thank you!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by