how to conver to 3d plot to 2d plot well?

138 ビュー (過去 30 日間)
Sierra
Sierra 2022 年 5 月 21 日
回答済み: Voss 2022 年 5 月 21 日
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!

採用された回答

Voss
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 件)

カテゴリ

Help Center および File ExchangeColorbar についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by