How to create a graph with a shaded area ?
조회 수: 3 (최근 30일)
이전 댓글 표시
how to create a graph with a shaded area (rectangle with diagonal lines) ? I would like to create a graph (in MATLAB) similar to this:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/152803/image.png)
댓글 수: 0
채택된 답변
Azzi Abdelmalek
2013년 11월 1일
편집: Azzi Abdelmalek
2013년 11월 2일
a=8; % Rectangle width
b=15; % Rectangle height
n=8; % Number of stripes is equal to 2*n
plot([0 a a 0 0],[0 0 b b 0],'k','linewidth',4)
set(gca,'xlim',[0 a*1.2],'ylim',[0 b*1.2]);
x11=[zeros(1,n) linspace(0,a,n);linspace(0,a,n) ones(1,n)*a]
y11=[linspace(0,b,n) b*ones(1,n);zeros(1,n) b-fliplr(linspace(0,b,n))]
hold on
plot(x11 ,y11,'k','linewidth',4)
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Graph and Network Algorithms에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!