GeographicAxesにpcolorで色付け

方法

GeographicAxesに直接pcolor的なことをするコマンドはないみたいなので,同じ枠範囲のAxesを作成して,色塗り以外の部分を全て消して画角を揃えることでなんとかする.

Untitled
clear
close all
 
%% 適当な範囲の指定
latlim = [33,36];
lonlim = [138,143];
 
%% GeographicAxes で背景を表示
fig = figure;
ax1 = geoaxes(Basemap='satellite', FontName='Helvetica', FontSize=12);
geolimits(latlim,lonlim);
geotickformat(ax1,'-dd');
ax1.LongitudeLabel.String = '';
ax1.LatitudeLabel.String = '';
pos = ax1.Position;
ax1.Position = [pos(1),pos(2),0.9*pos(3),pos(4)];
pos = ax1.Position;
lx = ax1.LongitudeLimits;
ly = ax1.LatitudeLimits;
%% 別の軸をAxesで作ってpcolorで塗る
ax2 = axes;
N = 61;
lon = linspace(140,142,N);
lat = linspace(34,35,N);
 
p = pcolor(lon,lat,peaks(N)); shading flat
p.FaceAlpha = 0.4; % 不透過度,背景とpcolorの色次第で調整する
colormap(ax2,turbo);
clim(ax2,[-4,4])
cb = colorbar(ax2, Location='eastoutside',FontName='Helvetica',FontSize=14);
cb.Position(1) = cb.Position(1);
cbt = cb.Ticks;
cb.Ticks = cbt;
cb.TickLabels = num2str(cbt','%0.1f');
 
%% 背景が見えるように塗った部分以外を非表示にして,表示範囲をサイズを統一
ax2.Visible = 'off'; ax2.XTick = []; ax2.YTick = [];
ax2.Position = ax1.Position;
xlim(ax2,ax1.LongitudeLimits);
ylim(ax2,ax1.LatitudeLimits);


Front page   Edit Diff Attach Copy Rename Reload   New List of pages Search Recent changes   Help   RSS of recent changes
Last-modified: 2025-05-08 (Thu) 23:12:06 (14d)