Assign a colormap to a geoglobe plot

18 views (last 30 days)
Hello
I have flight data from my drone: longitude, latitude, altitude.
I would like to put a flight profile on geoglobe.
I manage to get a result, nevertheless the flight tracing is of a single color.
I would like this line to correspond to the altitude or to altitude steps by using, for example, a colormap.
I couldn't figure out how to change the color on this chart and this is the first time I've used the uifigure.
Thank you :)
my code :
uif = uifigure("Name","Vol drone sur cartographie 3D");
uif.Position = [1320 100 1280 1080];
g = geoglobe(uif);
geoplot3(g,lat,lon,alt_abs,'LineWidth',4,'color','y')

Accepted Answer

Walter Roberson
Walter Roberson on 10 Dec 2024
Any one geoplot3() call results in a single line of constant color. There is no way to have the single line be multiple colors or interpolated colors.
You will need to call geoplot3() several times, each time drawing a different (constant) color. For any one segment, it is not possible to do color interpolation.
  4 Comments
Marc Jakubowicz
Marc Jakubowicz on 11 Dec 2024
Edited: Marc Jakubowicz on 11 Dec 2024
It's not bad, it's beautiful, but it's a long time to trace
I put a geo.mat if you want to test
uif = uifigure("Name","Vol drone sur cartographie 3D");
uif.Position = [1320 100 1280 1080];
g = geoglobe(uif);
hold(g,'on')
cmap = colormap('jet');
len=numel(alt_abs);
alt_maxi=max(alt);
alt_min=min(alt);
alt_color=alt+abs(alt_min);
coef=257/max(alt_color);
alt_color=round(coef*alt_color);
step=10;
for i=1:step:(len-step)
color_idx=1+round((alt(i)+abs(alt_min))/(alt_maxi+abs(alt_min))*255);
geoplot3(g,lat(i:i+step),lon(i:i+step),alt_abs(i:i+step),'LineWidth',4,'color',cmap(color_idx,:))
end

Sign in to comment.

More Answers (0)

Categories

Find more on Geographic Plots in Help Center and File Exchange

Products


Release

R2024b

Community Treasure Hunt

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

Start Hunting!