
How to plot multiple lines over a geographic area using the 'geoplot3' and 'geoglobe' functions?
26 ビュー (過去 30 日間)
古いコメントを表示
MathWorks Support Team
2020 年 4 月 29 日
編集済み: MathWorks Support Team
2022 年 12 月 22 日
How to plot multiple 3d plots using the 'geoplot3' and 'geoglobe' functions?
採用された回答
MathWorks Support Team
2022 年 10 月 18 日
編集済み: MathWorks Support Team
2022 年 12 月 22 日
There are two things to keep in mind while using the 'geoglobe' function to plot multiple plots:
1. Firstly, the 'geoglobe' function has a default property of deleting existing plots and reset globe properties, except 'Position' and 'Units', to their default values before displaying the new plot. In order to allow multiple plots to be plotted on the globe the user needs to specify the 'NextPlot' name-value pair argument as 'add' as shown below in the example:
uif = uifigure;
g = geoglobe(uif,'NextPlot','add');
Additionally, please refer to the following documentation regarding the NextPlot property:
https://www.mathworks.com/help/map/ref/globe.graphics.geographicglobe.html#mw_6c760b8f-7d02-4f56-95f1-85a0ec557e20
2. Secondly, only certain 'hold' syntaxes are supported by the 'geoglobe' function as shown below:
hold(g) %toggles the state between off and on
hold(g,'on') % retains plot so that new plots can be added to the same plot
hold(g,'off') % releases the current plot
Please refer to this documentation link which describes the supported 'hold' syntax:
https://www.mathworks.com/help/map/ref/globe.graphics.geographicglobe.html#mw_6ed71245-e876-4a96-9bb1-eb2162df345d
Additionally, please refer to this sample MATLAB code that will demonstrate how to plot multiple line plots over a local region using the 'geoplot3' function:
trk = gpxread('sample_mixed','FeatureType','track');
lat = trk.Latitude;
lon = trk.Longitude;
h = trk.Elevation;
lat1 = 0.98*(trk.Latitude);
lon1 = 0.98*(trk.Longitude);
h1 = 0.98*(trk.Elevation);
uif = uifigure;
g = geoglobe(uif,'NextPlot','add');
geoplot3(g,lat,lon,h,'c')
hold(g,'on')
mskip = 1:25:length(lat1);
geoplot3(g,lat1,lon1,h1,'ro','MarkerIndices',mskip)
Resulting figure:

0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Geographic Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!