필터 지우기
필터 지우기

3D plot with colored planes

조회 수: 8 (최근 30일)
Atom
Atom 2012년 10월 20일
댓글: LO 2021년 3월 7일
I use
plot3(x,y,z, 'b')
box on
for plotting a 3D system. I want the faces of xy-plane, yz-plane and zx-plane to be colored by blue, red and white respectively.
Please suggest me the code. Thanks in advance.

답변 (1개)

Walter Roberson
Walter Roberson 2012년 10월 20일
You can determine the axis sizes by get(gca, 'XLim') and YLim and ZLim. Using those values, you can create patch() objects that are rectangles in 3-space with the colors you want.
  댓글 수: 3
Walter Roberson
Walter Roberson 2012년 10월 20일
XL = get(gca, 'XLim');
YL = get(gca, 'YLim');
patch([XL(1), XL(2), XL(2), XL(1)], [YL(1), YL(1), YL(2), YL(2)], [0 0 0 0 0], 'FaceColor', [0 1 0]);
LO
LO 2021년 3월 7일
typo: there is a 5th 0 in your Z vector that you do not need

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

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by