Plot two axesm with different colormaps

조회 수: 7 (최근 30일)
MathWorks Support Team
MathWorks Support Team 2017년 9월 11일
답변: MathWorks Support Team 2018년 1월 3일
How to plot two axesm with different colormaps in the same graph?

채택된 답변

MathWorks Support Team
MathWorks Support Team 2017년 9월 11일
In mapping Toolbox, axesm doesn’t create a new axes (it modifies the current axes), so the handles to the first and second call to axesm are the same axes. 
The second colormap overwrites the first one. 
In order to have two colormaps, a new axes needs to be created for the second map axes.  
For example, 
% create the first axis
hAxesJ = axesm('MapProjection','mercator',...
'Frame','on',...
'Grid','on',...
'GColor','k',...
'MapLatLimit',[25 75],...
'MapLonLimit',[-100 20],...
'ParallelLabel','on',...
'MeridianLabel','on',...
'FontSize',10);
colormap(hAxesJ,winter);
% Create a second axes
hAxesS = axes;
% Turn off the decorations, backdrop etc. of the second axes so it doesn't cover the first one
axis(hAxesS,'off')
% Make sure the second axes is current (gca)
axes(hAxesS)
hAxesd = axesm('MapProjection','mercator',...
'Frame','on',...
'Grid','on',...
'GColor','k',...
'MapLatLimit',[25 75],...
'MapLonLimit',[-100 20],...
'ParallelLabel','on',...
'MeridianLabel','on',...
'FontSize',10);
cbS = colorbar(hAxesd,'Location','east');
%set colormap for second axes
colormap(hAxesd,spring);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Red에 대해 자세히 알아보기

제품


릴리스

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by