使用MATLAB画出地球仪图形

时间:2024-03-22 21:32:05

代码如下所示:

% 绘制地球仪,并标出我们的位置

cla reset;
load topo;
[x y z] = sphere(45);
s = surface(x,y,z,'FaceColor','texturemap','CData',topo);
 colormap(topomap1);
% Brighten the colormap for better annotation visibility:
 brighten(.6)
% Create and arrange the camera and lighting for better visibility:
% campos([1.3239  -14.4250  9.4954]);
campos([0 0 0]);
 camlight;
 lighting gouraud;
axis off vis3d;
% Set the x- and y-coordinates of the textarrow object:
x = [0.7698 0.5851];
 y = [0.3593 0.5492];
% Create the textarrow object: 

txtar =  annotation('textarrow',x,y,'String','This is China.','color','red','FontSize',14);

运行后的结果图

使用MATLAB画出地球仪图形

代码如下:

 %绘制地球仪
 clear;
 figure
 grs80=almanac('earth','grs80');
 ax=axesm('globe','Geoid',grs80,'Grid','on','GLineStyle','-','Gcolor','yellow');
 set(ax,'Position',[0 0 1 1]);
 view(3);
 axis equal off vis3d;
 set(gcf,'Renderer','opengl');
 load topo
 geoshow(topo,topolegend,'DisplayType','texturemap');
 demcmap(topo);

运行结果如图所示

使用MATLAB画出地球仪图形