📄 plotmapc.m
字号:
function [] = plotmapc(data,lat,lon,proj,titname,colbar);% plotmapc -- Plots a map for a given field - this is the complex% and unstable version of this function. See plotmap for a simple% version without colour specifications.%% data - the data field you want to map%% lat - latitude information for the field%% lon - Longitude information for the field%% proj - the projection you want: See the details section% below for information on available projections%% titname - the title for the plot%% colbar - orientation of the colorbar: 'hori' or 'vert' or 'none'% The default is 'hori' for equidistant cylindrical plots% and 'vert' for polar plots.%% DETAILS:%% The field should be lon x lat%% The projection can be any of the following:% 'n' - Equidistant cylindrical projection% The default - probably the most clear% Polar perspectives:% 'b' - Breusing Harmonic Mean projection% Shows tropical latitudes in true perspective% 'v' - Vertical perspective projection% Squashes tropics - but this is usually desirable% 's' - Stereographic projection% Very similar to vertical perspective, but does% sometimes look bad.%% (The polar perspectives currently only do the North pole;% if you want the south pole, let me know.)%% To use this function you need the Mapping Toolbox%%%% EXAMPLES:% plotmap(rsquared,lat,lon)%% plotmap(rsquared,lat,lon,'b','R^2 from Geopotential height for DJF at 200hPa vs Year','horiz')% Written by Matt Sapiano, November 2002tit=1;if nargin < 3, help(mfilename), return, endif nargin == 3,proj='n';titname='notitle';colbar='none';elseif nargin == 4,titname='notitle';colbar='none';elseif nargin == 5,colbar='none';elseif nargin > 7, help(mfilename), return,endif(titname=='notitle'), tit=0;enddata=squeeze(data);[leni lenj]=size(data);if leni==length(lon), data=data';elseif leni~=length(lat) | lenj~=length(lon), returnendif proj~='n', if proj=='b', %Breusing Harmonic Mean projection axesm('breusing','origin',[90 0 0],'maplatlimit',[0 90]); elseif proj=='v', %Vertical perspective axesm('vperspec','origin',[90 0 0],'maplatlimit',[0 90]); elseif proj=='s', %Stereographic perspective axesm('stereo','origin',[90 0 0],'maplatlimit',[0 90]); end [meshlat,meshlon] = meshgrat(lat,[lon;lon(1)]); surfm(meshlat,meshlon,[data data(:,1)]); shading interp; axis tight; if(colbar == 'hori'), colormap(colors2(2)); colorbar('horiz'); elseif(colbar~='none' | colbar~='n'), colormap(colors(2)); colorbar; end plotm(coast,'k'); framem; gridm; hidem(gca); if tit~=0, f=axes; set(f,'Position',[0 0 1 1],'Visible','off'); text(0.5,0.95,titname,'HorizontalAlignment','center','FontSize',[14],'FontWeight','bold'); endelse [leni lenj]=size(data); axesm eqdcylin; [meshlat,meshlon] = meshgrat(lat,[lon((lenj/2+1):lenj);lon(1:(lenj/2))]); surfacem(meshlat,meshlon,[data(:,(lenj/2+1):lenj),data(:,1:(lenj/2))]); axis tight; setm(gca,'origin',[0 -0.0001 0]); shading interp; if colbar=='vert', colormap(colors(2)); colorbar; elseif(colbar~='none' | colbar~='n'), colormap(colors2(2)); colorbar('horiz'); end plotm(coast,'k'); if tit~=0, title(titname,'FontSize',[14],'FontWeight','bold'); endendhold off
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -