how to conver to 3d plot to 2d plot well?
70 次查看(过去 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!