Sie sind auf Seite 1von 5

OPeNDAP URL: http://apdrc.soest.hawaii.

edu/dods/public_data/MODIS_Aqua/4km_day
DATASET: MODIS Aqua monthly 4km
VARIABLE: sea_surface_temperature [day] (degc)
TIME : 01-JUL-2002 00:00

Subsampled 16 in X, 16 in Y

Data MoDIS

Any size of matrix works for me. In the example below my matrices are the same
size as yours:
% Generate data
[X Y Z] = peaks(40);
Z = abs(Z) * 100 + 1;
% Resize the data to be rectangular
X = X(1,:);
Y = Y(1:2,1);
Z = Z(1:2,:);
% Generate log-scale texture
T = real2rgb(log(Z), 'jet');
% Render the surface
surf(X, Y, Z, T);
set(gca,'Zscale','log','Clim',[min(Z(:)) max(Z(:))]);
% Generate the colorbar
colormap jet;
h=colorbar;
set(h,'YScale','log')

% Generate data
> > [X Y Z] = peaks(50);
> > Z = abs(Z) * 100 + 1;
> > % Generate log-scale texture
> > T = real2rgb(log(Z), 'jet');
> > % Render the surface
> > surf(X, Y, Z, T);
> > set(gca,'Zscale','log','Clim',[min(Z(:)) max(Z(:))]);
> > % Generate the colorbar
> > colormap jet;
> > h=colorbar;
> > set(h,'YScale','log')

I have this code,


> > > surf(x,y,abs(D));
> > > set(gca,'Zscale','log')
> > > h=colorbar;
> > > set(h,'YScale','log')
> > > xlabel('x-axis')
> > > ylabel('y-axis')
> > > zlabel('function')

% D is your data
% Rescale data 1-64
d = log10(D);
mn = min(d(:));
rng = max(d(:))-mn;
d = 1+63*(d-mn)/rng; % Self scale data
image(d);
hC = colorbar;
L = [0.01 0.02 0.05 0.1 0.2 0.5 1 2 5 10 20 50 100 200 500 1000 2000 5000];
% Choose appropriate
% or somehow auto generate colorbar labels
l = 1+63*(log10(L)-mn)/rng; % Tick mark positions
set(hC,'Ytick',l,'YTicklabel',L);

Contours=[1 3 10 30 100 300 1000];


contourf(log(Data(:,:)),log(Contours));

1) Define Your Contours Define where you'd like contours. For the plot here, I
used:
Contours=[1 3 10 30 100 300 1000];
2) Plot your Data Using imagesc, contourf, or some other function, plot the log
of your data. Also be sure to take the log of your defined contours so they show
up in the right spot.
contourf(log(Data(:,:)),log(Contours));
3) Define the tick marks on your colorbar The last step is to make the
colorbar show the correct data. Use:
colorbar('YTick',log(Contours),'YTickLabel',Contours);
colormap(jet);
caxis(log([Contours(1) Contours(length(Contours))]));
4) Make sure the last thing you do is set the Ticks! I've noticed if you have
any other commands after this in the colorbar command, it reverts back to
something funky.

Example: Correct:
colorbar('FontSize',12,'YTick',log(Contours),'YTickLabel',Contours);
Incorrect:
colorbar('YTick',log(Contours),'YTickLabel',Contours,'FontSize',12);

### Examples ###


% Plot a scheme's RGB values:
rgbplot(brewermap(9,'Blues')) % standard
rgbplot(brewermap(9,'*Blues')) % reversed
% View information about a colorscheme:
[~,num,typ] = brewermap(0,'Paired')
num = 12
typ = 'Qualitative'
% Multiline plot using matrices:
N = 6;
axes('ColorOrder',brewermap(N,'Pastel2'),'NextPlot','replacechildren')
X = linspace(0,pi*3,1000);
Y = bsxfun(@(x,n)n*sin(x+2*n*pi/N), X.', 1:N);
plot(X,Y, 'linewidth',4)
% Multiline plot in a loop:
N = 6;
set(0,'DefaultAxesColorOrder',brewermap(N,'Accent'))
X = linspace(0,pi*3,1000);
Y = bsxfun(@(x,n)n*sin(x+2*n*pi/N), X.', 1:N);
for n = 1:N
plot(X(:),Y(:,n), 'linewidth',4);
hold all
end
% New colors for the COLORMAP example:
load spine
image(X)
colormap(brewermap([],'YlGnBu'))
% New colors for the SURF example:
[X,Y,Z] = peaks(30);

surfc(X,Y,Z)
colormap(brewermap([],'RdYlGn'))
axis([-3,3,-3,3,-10,5])
% New colors for the CONTOURCMAP example:
brewermap('PuOr'); % preselect the colorscheme.
load topo
load coast
figure
worldmap(topo, topolegend)
contourfm(topo, topolegend);
contourcmap('brewermap', 'Colorbar','on', 'Location','horizontal',...
'TitleString','Contour Intervals in Meters');
plotm(lat, long, 'k')
### Note ###
Compared to other ColorBrewer submissions available on MATLAB File Exchange,
BREWERMAP:
* Consists of just one convenient M-file (no .mat files).
* Requires just the standard ColorBrewer scheme name to select the colorscheme.
* Supports all ColorBrewer colorschemes.
* Outputs a MATLAB standard N-by-3 numeric RGB array.
* Default length is the standard MATLAB default colormap length (same length as the
current colormap).
* Is compatible with all MATLAB functions that use colormaps (eg: CONTOURCMAP).
* Includes the option to reverse the colormap color sequence.
* Does not break ColorBrewer's Apache license conditions!
This product includes color specifications and designs developed by Cynthia Brewer
(http://colorbrewer.org/). See the ColorBrewer website for further information about each
colorscheme, colorblind suitability, licensing, and citations. Note that BREWERMAP is the
only submission on MATLAB File Exchange providing ColorBrewer colorschemes without
breaking the Col

cMap=hsv(250);
colormap(cMap);
caxis([min(M(:)) max(M(:))]);

Min=0.8;

Max=12;
h = colorbar('horiz');
set(h,'location','southoutside')
set(h,'XTickLabel',{num2str(Min),'mm'

,num2str(Max)})

Das könnte Ihnen auch gefallen