![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/189777/image.png)
Inserting slice into a scatter 3D plot
조회 수: 9 (최근 30일)
이전 댓글 표시
I have been able to generate a scatter3 plot similar to one under visualize a function of 3 variables https://www.mathworks.com/help/matlab/examples/visualizing-four-dimensional-data.html. I would like to insert a slice at a certain z value. To the use the referenced plot as an example, if I wanted to have a transparent red plane at the 30% of Rural Population, how would I generate that
댓글 수: 0
답변 (1개)
Star Strider
2018년 7월 5일
편집: Star Strider
2018년 7월 6일
With respect to that example, add the lines between hold on and hold off in this code to get the plane you want:
scatter3(long,lat,rural,40,fatalities,'filled') % draw the scatter plot
ax = gca;
ax.XDir = 'reverse';
view(-31,14)
xlabel('W. Longitude')
ylabel('N. Latitude')
zlabel('% Rural Population')
hold on
xl = xlim;
yl = ylim;
patch([[1 1]*xl(1) [1 1]*xl(2)], [yl fliplr(yl)], [1 1 1 1]*30, 'r', 'FaceAlpha',0.2);
hold off
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/189777/image.png)
EDIT — Added plot image. (6 Jul 2018 at 00:52 UTC)
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!