how to conver to 3d plot to 2d plot well?
조회 수: 71 (최근 30일)
이전 댓글 표시
i know how to convert to 3d to 2d plot
first, 3d plot has three axes but if you convert 3d to 2d, it only has two axes.
so what i'm asking is that how to conver to 3d plot to 2d plot with three infrmation(x,y,z)?
ex) i have longitude, latitude and altitude data. and i want to plot this data well with 2d plot
thanks!
댓글 수: 0
채택된 답변
Voss
2022년 5월 21일
You could make a 2d plot of some kind whose color comes from the data in the 3rd dimension, e.g., a surface or a contour:
lat = -50:5:50;
long = -100:5:100;
altitude = 6000-sqrt(lat(:).^2+long.^2);
% first, a 3d scatter plot:
subplot(3,1,1)
[x,y] = meshgrid(long,lat);
scatter3(x(:),y(:),altitude(:));
xlabel('Longitude');
ylabel('Latitude');
zlabel('Altitude');
% second, a surface of the same data,
% colored according to altitude:
subplot(3,1,2)
surface(long,lat,altitude)
xlabel('Longitude');
ylabel('Latitude');
cb = colorbar();
cb.YLabel.String = 'Altitude';
% third, a filled contour of the same data,
% colored according to altitude:
subplot(3,1,3)
contourf(long,lat,altitude)
xlabel('Longitude');
ylabel('Latitude');
cb = colorbar();
cb.YLabel.String = 'Altitude';
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Scatter Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!