How to plot a filled box?
조회 수: 19 (최근 30일)
이전 댓글 표시
Hello everyone,
in 2 dimensions I can plot a shaded rectangle with the following code:
h=fill([0,1,1,0],[0,0,2,2],'red');
h.FaceAlpha=0.3;
My question is, how to do the same thing in 3 dimensions (with height=1). Then a rectangle would be a box.
Thanks, Stephan
댓글 수: 0
채택된 답변
Jos (10584)
2017년 12월 5일
Plot each of the sides separately
h = fill3([1 1 2 2],[1 2 2 1],[1 1 1 1],'r', ...
[1 1 2 2],[1 2 2 1],[2 2 2 2],'r', ...
[1 1 1 1],[1 2 2 1],[1 1 2 2],'b', ...
[2 2 2 2],[1 2 2 1],[1 1 2 2],'b', ...
[1 1 2 2],[1 1 1 1],[1 2 2 1],'g-',...
[1 1 2 2],[2 2 2 2],[1 2 2 1],'g-') ;
set(h,'FaceAlpha',0.3) ;
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Line Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!