Fill a specific area of the plot with Diagonal Lines, or Vertical Lines

21 views (last 30 days)
Hello,
My objective is to produce within a range, diagonal lines or horizontal lines instead of just filling the all space with a colour, as you can see in the image I have attached.
x = 1:100;
f = sin(x);
x1 = [20 35 35 20]
y1 = [0.4 0.4 0.7 0.7]
plot(x,f);
patch(x1,y1,'b')
  8 Comments
Tiago Dias
Tiago Dias on 27 Apr 2018
oh ok, i was trying somrthing like hatchill.Color = 'red' but wasnt going anywhere xD thanks mate

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!