2016-08-25 6 views
1

geoshowコマンドを使用して、mollweide投影で世界地図をプロットしようとしています。しかし、私はcutomizedカラーマップ値に基づいてプロットの色を変更することができません。おそらく、これはaxesmとgeoshowのコマンドが一緒に使われる方法の問題です。私を助けてください。参考文献を参照してください。以下のコード:私の同僚のmatlabのgeoshowにカスタマイズされたカラーマップをつける

G = rand(180,360); 
G(1:90,:)=-1*G(1:90,:); 
R = georasterref('RasterSize',size(G),... 
    'Latlim',[-90 90], 'Lonlim', [-180 180],'ColumnsStartFrom','north'); 

% ref this link: http://stackoverflow.com/questions/34727526/matlab-plot-raster-map-with-custom-colormap/34740112#34740112 
%setting up graphics parameters 
my_colormap = [254 204 92 
       253 141 60 
       240 59 32 
       189 0 38]/255 ; 

startval=min(min(G)); 
endval=max(max(G)); 
nElements =size(my_colormap,1); 
stepSize=(endval-startval)/(nElements-1); 
breaks = startval:stepSize:endval; 
labels = textscan(num2str(round((breaks*100))/100),'%s') ; 
labels = labels{1}; 
[~,indices] = histc(G,breaks); 

%actual graphics    
figure 
hm=axesm ('mollweid', 'Frame', 'on', 'Grid', 'off'); 
geoshow(G,R);%geoshow(indices,R); 

colormap(my_colormap); 
set(gca,'color','none'); 
set(gca,'box','off','xtick',[],'xcolor','none') 
set(gca,'box','off','ytick',[],'ycolor','none') 
hc=colorbar('location','southoutside'); 
caxis([breaks(1) breaks(length(breaks))])%caxis([0 length(breaks)-1]) 
hcP = [.7 .28 .2 .02]; 
set(hc,'position',hcP); 
h.YTickLabel = labels ; 
+0

任意の提案ですか? – Munish

答えて

0

1は、ソリューションに私を指摘しての他の参考のためにそれをここに掲示しています: geoshow(G、R、 'DisplayType'、 'texturemap')

関連する問題