Link longitudonal data of axesm with x-data of plot

Hello,
I have a figure with 2 subplots. The top subplot is an axesm-plot of the English Channel with a route of a ship sailing from Holland to England.
In the lower subplot I have the speed of this ship (y-axis) as a function of its longitudinal position (x-as).
My question: I want the x-axis of the axesm-plot and the data plot linked/aligned so that the speed can be read easily.
This is what I have now:
My code:
disp('Draw map...');
h=figure('color','w','Position', [20 20 1000 800]);
sp1=subplot(2,1,1);
axesm('mapproj','mercator',...
'maplatlim',[51 53],'maplonlim',[-2 5],'MLineLocation',[0 2 4],'PLineLocation',[51 52 53],'FFill',50);
axis off, gridm on, framem on;
%setm(ha,'MLineLocation',15,'PLineLocation',15);
mlabel on, plabel on;
load coast;
hg = geoshow(lat,long,'displaytype','line','color','b');
disp('Display interesting points on map...');
hoek_holland = [51.9834,4.131889];
harwich= [51.936857, 1.260509];
london= [51.523271,-0.127716];
geoshow(hoek_holland(1),hoek_holland(2),'DisplayType','point',...
'markeredgecolor','k','markerfacecolor','k','marker','o')
textm(hoek_holland(1)-0.2,hoek_holland(2)+0.1,sprintf('Hoek van\nHolland'));
geoshow(harwich(1),harwich(2),'DisplayType','point',...
'markeredgecolor','k','markerfacecolor','k','marker','o')
textm(harwich(1)+0.2,harwich(2)-0.26,'Harwich');
geoshow(london(1),london(2),'DisplayType','point',...
'markeredgecolor','k','markerfacecolor','k','marker','o')
textm(london(1)+0.2,london(2)-0.26,'London');
disp('Calculating track...');
load('POSITION.mat')
lat= radtodeg(LAT(idx));
long= radtodeg(LONG(idx));
[lattrk,lontrk] = track(lat,long);
disp('Plot track...');
sp2=plotm(lattrk,lontrk,'r');
subplot(2,1,2);plot(radtodeg(LONG_idx),SOG_idx);
linkaxes([sp1 sp2],'x');

Answers (0)

Products

Asked:

on 6 Dec 2012

Community Treasure Hunt

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

Start Hunting!