我会采取的方法是使用你的面具来提高透明度。这稍微复杂一些,pcolor
因为它不允许您在创建绘图时直接设置属性,但您可以抓住它的句柄并这样做。
要覆盖点画,您可以hold on
让 pcolor 绘图不会消失,并使用“绘图”在您想要的位置绘制点。
Lon = (-179:1:180)'; %# comment for formatting'
Lat = -90:1:90;
data = randn(length(Lon),length(Lat)); #% generate random data
mask = randi(2,size(data))-1; #% generate a random mask (zeros and ones)
point_matrix = randi(4,size(data)-1)==4; #% random (logical) matrix
[r c]=find(point_matrix==1); %# get the coordinates of the ones
figure;
hold on;
#% save a handle to the surface object created by pcolor
h=pcolor(repmat(Lon ,1,length(Lat)),repmat(Lat,length(Lon),1),data);
#% set properties of that surface: use mask as alphadata for transparency
#% and set 'facealpha' property to 'flat', and turn off edges (optional)
set(h,'alphadata',mask,'facealpha','flat','edgecolor','none');
#% overlay black dots on the center of the randomly chosen tiles
plot(r-179.5,c-89.5,'.k')