Linking line plot and map (geoshow) together MATLAB
Mostra commenti meno recenti
Hello all:
I wish to combine the MATLAB spatial plot generated through mapping function and the line plot on the same axis scale. However, the linkprop function is not working in this case. Please suggest how to make both axis similar?
Here is my code:
figure(1);
AX1 = subplot(1,2,1);
ax=axesm('mercator','MapLatLimit',[-65 65],'MapLonLimit',[-180 180]);
f=worldmap([-60 80],[-180 180]);
h = geoshow(coast1, 'DisplayType', 'polygon','facecolor','w');
oceanColor = [.7 .8 .9];%[.5 .7 .9];
setm(ax,'FFaceColor',oceanColor);
setm(ax, 'meridianlabel', 'on', 'parallellabel', 'on');
setm(gca,'mlabelparallel',-90);
hold on;
%Define coordinates for tropical lines
yvec = -180:180;
xvec = ones(size(yvec));
geoshow(23.5*xvec,yvec,'DisplayType','Line','LineWidth',1,'LineStyle','--','Color','k'); hold on;
geoshow(-23.5*xvec,yvec,'DisplayType','Line','LineWidth',1,'LineStyle','--','Color','k'); hold on;
geoshow(35*xvec,yvec,'DisplayType','Line','LineWidth',0.8,'LineStyle','--','Color','r'); hold on;
geoshow(-35*xvec,yvec,'DisplayType','Line','LineWidth',0.8,'LineStyle','--','Color','r'); hold on;
AX2 = subplot(1,2,2);
h1 = plot(B1,X_dist(:,2),'r--','linew',0.8); hold on;
h2 = plot(B,X_dist(:,2),'r-','linew',1.8); hold on;
h3 = plot(B2,X_dist(:,2),'r--','linew',2); hold on;
set(gca,'fontsize',14,'fontname','arial');
degreetick 'y';
linkprop(AX1,'YLim');
linkprop(AX2,'YLim');
However, I am unable to adjust the size and Y-labels of both subplots. The latitudes of both subplots should match.
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Create Plots on Maps in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

