contourcmap issues

Hi, I am having issues with contourcmap and I believe my version is 2010b.
Just to give you an idea of what my code looks like, here are a few lines before my contonurcmap command, since i am using contourfm, i cant use colorbar (and represent what I want it to) so i am using contourcmap, when I try the examples listed online, I get all kinds of errors
figure(y-1)
axesm('MapProjection','eqdcylin', 'MapLatLimit', latlim, 'MapLonLimit', lonlim, 'Frame', 'on');
load coast;
plotm(lat,long,'k')
contourfm( lata, lon, squeeze(monanom(y,:,:)),20,'linestyle', 'none')
I then tried:
contourcmap('jet', 10, 'Colorbar', 'on', ...
'Location', 'horizontal', ...
'TitleString', 'Contour Intervals in Meters');
I GOT THIS ERROR
Warning: The 'CDELTA' parameter is ignored with contour
objects.
> In contourcmap>validateContourParams at 282
In contourcmap at 95
In readsst at 34
I also tried, just in case,
contourcmap(10, 'jet', 'Colorbar', 'on', ...
'Location', 'horizontal', ...
'TitleString', 'Contour Intervals in Meters');
when I dont include, the '10, there is no issue but I also want to control the increment on my color bar and the amount of color levels, do you have any suggestions and can figure out the problem?
I also tried
contourcmap('jet',[0:5:50],...
'colorbar','on','location','horizontal')
straight off the website for help and got the error
Warning: The 'CDELTA' parameter is ignored with contour
objects.

Respuestas (1)

Walter Roberson
Walter Roberson el 3 de Oct. de 2011

0 votos

The documentation does specifically say,
contourcmap(cmapstr,cdelta) updates the figure's colormap with colors varying according to cdelta. If the axes contains Mapping Toolbox contour objects, the value of cdelta is ignored.
Your axes do, however, contain Mapping Toolbox contour objects.
If I read your code and the documentation correctly, you appear to have asked for 20 total contour levels to be generated, spread out evenly over the range of the data, but you are hoping to generate a colormap which is in fixed increments of 10 meters. I do not think I see the point, since the fixed 10 meters could cover anywhere from a fraction of a contour interval to several contour intervals, depending on the data being mapped.
Would you not prefer to specify explicit contour levels in your contourfm call?

2 comentarios

kieran
kieran el 3 de Oct. de 2011
sorry walter, I also tried without the 20 total contour level entries and received the same error,
kieran
kieran el 3 de Oct. de 2011
also, for some reason, specifying the explicit contour levels does not help either, see below:
where precip.mon.mean.nc comes from the website http://www.esrl.noaa.gov/psd/data/gridded/data.cmap.html#detail
precip=getnc('precip.mon.mean.nc','precip');
time=getnc('precip.mon.mean.nc','time');
lata=getnc('precip.mon.mean.nc','lat');
lon=getnc('precip.mon.mean.nc','lon');
%lat2=[-89.50:1:89.5]; lon2=[-179.5:1:179.5]; time=[1:1:357];
%b(:,:,181:360)=sst(:,:,1:180);
%b(:,:,1:180,:)=sst(:,:,181:end);
latlim = [-60 70];
lonlim = [100 -70];
%29 year avg 1982-2010
longavg=squeeze(mean(precip(1:360,:,:)));
monsum=zeros(13,72,144);
yearsum=zeros(30,72,144);
for a=1:30
for x=2:13
yearsum(a,:,:)=precip((a-1)*12+x,:,:)+ yearsum(a,:,:);
end
yearavg(a,:,:)=yearsum(a,:,:)./12;
yearanom(a,:,:)=squeeze(yearavg(a,:,:))-longavg;
end
%http://ggweather.com/enso/oni.htm, used to pick la nina, enso, and neutral
for y=2:13
for i=1:30
monsum(y,:,:)=precip(y+12.*(i-1),:,:)+monsum(y,:,:);
% monavg(y,:,:)=mean(precip(y+12.*(i-1),:,:));
end
monavg(y,:,:)=monsum(y,:,:)./30;
monanom(y,:,:)=squeeze(monavg(y,:,:))-longavg;
figure(y-1);
axesm('MapProjection','eqdcylin', 'MapLatLimit', latlim, 'MapLonLimit', lonlim, 'Frame', 'on');
load coast;
plotm(lat,long,'k')
contourfm( lata, lon, squeeze(monanom(y,:,:)),-10:1:10, 'linestyle', 'none')
axis tight
cb= contourcmap( 'jet', 'Colorbar', 'on', ...
'Location', 'horizontal');
% 'TitleString', 'SST Anomaly');
set(get(cb,'XLabel'),'String','Precip in mm/day')
if y==2
title('January Precip Anomaly compared to 30-year Annual Mean (1979-2009)', 'fontsize', 14);
elseif y==3
title('February Precip Anomaly compared to 30-year Annual Mean (1979-2009)', 'fontsize', 14);
elseif y==4
title('March Precip Anomaly compared to 30-year Annual Mean (1979-2009)', 'fontsize', 14);
elseif y==5
title('April Precip Anomaly compared to 30-year Annual Mean (1979-2009)', 'fontsize', 14);
elseif y==6
title('May Precip Anomaly compared to 30-year Annual Mean (1979-2009)', 'fontsize', 14);
elseif y==7
title('June Precip Anomaly compared to 30-year Annual Mean (1979-2009)', 'fontsize', 14);
elseif y==8
title('July Precip Anomaly compared to 30-year Annual Mean (1979-2009)', 'fontsize', 14);
elseif y==9
title('August Precip Anomaly compared to 30-year Annual Mean (1979-2009)', 'fontsize', 14);
elseif y==10
title('September Precip Anomaly compared to 30-year Annual Mean (1979-2009)', 'fontsize', 14);
elseif y==11
title('October Precip Anomaly compared to 30-year Annual Mean (1979-2009)', 'fontsize', 14);
elseif y==12
title('November Precip Anomaly compared to 30-year Annual Mean (1979-2009)', 'fontsize', 14);
elseif y==13
title('December Precip Anomaly compared to 30-year Annual Mean (1979-2009)', 'fontsize', 14);
end
end

Iniciar sesión para comentar.

Categorías

Más información sobre Geographic Plots en Centro de ayuda y File Exchange.

Productos

Etiquetas

Preguntada:

el 2 de Oct. de 2011

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by