필터 지우기
필터 지우기

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

조회 수: 10 (최근 30일)
Tiago Dias
Tiago Dias 2018년 4월 27일
댓글: Tiago Dias 2018년 4월 27일
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
jonas
jonas 2018년 4월 27일
편집: jonas 2018년 4월 27일
Great, a general tip for matlab is to save the handle of your object (axes, line, figure etc..). For example,
hf = hatchfill(p);
You can then easily type get(hf) to get a list of all its properties, including the color, which you can then alter.
set(hf,'color',[1 0 0]) %sets line color to red
Tiago Dias
Tiago Dias 2018년 4월 27일
oh ok, i was trying somrthing like hatchill.Color = 'red' but wasnt going anywhere xD thanks mate

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by