pcolor/m_pcolor cannot create world map correctly
Mostrar comentarios más antiguos
Hello all,
I have an issue to create world mean temperature map correctly with pcolor/m_pcolor. There are strips on the map created. Please see the first map.
h1 = pcolor(lon,lat,statTa(:,:,i)); set(h1,'edgecolor','none'); colorbar;

When I use imagesc, it shows pretty well. Please see the second map. But I think I prefer to use pcolor/m_pcolor to create map since they are more powerful on creating maps. Please help me on what happened when I was using pcolor here. Thank you very much!
h2 = imagesc(lon,lat,statTa(:,:,i)); set(gca,'ydir','normal'); colorbar;

11 comentarios
Ashish Gudla
el 27 de Mayo de 2015
It might be possible that the lat,lon data is not uniform and pcolor is somehow trying to draw a line between non uniform grid while imagesc is not.
Is the data uniform? Also what version of MATLAB is this?
Chad Greene
el 29 de Mayo de 2015
Can you upload your lat,lon grids?
Rong Yu
el 5 de Jun. de 2015
Chad Greene
el 8 de Jun. de 2015
I cannot reproduce the problem. It looks like your oceans are set to NaN, so I'm doing the same below. I resize the dataset before using my landmask function because landmask is quite slow for large grids.
load lonLat
% Created gridded lat/lon:
[long,latg] = meshgrid(lon,lat);
% Create temperature-like data:
T = 250+50*cosd(latg) + 5*sind(long) + rand(size(latg));
% Set oceans to NaN:
scale = 5;
ocean = ~landmask(imresize(latg,1/scale),imresize(long,1/scale));
T(imresize(ocean,scale)) = NaN;
% Plot with pcolor:
h1 = pcolor(lon,lat,T);
set(h1,'edgecolor','none');
colorbar

Rong Yu
el 8 de Jun. de 2015
Chad Greene
el 8 de Jun. de 2015
Very strange. It works just fine for me in R2012b.
load lonLat
load monthTa1
h1 = pcolor(lon,lat,monthTa1);
set(h1,'edgecolor','none')
colorbar;
colormap(brewermap(1024,'Reds'))
set(gca,'color',rgb('ocean blue'))
borders('countries','color',.2*[1 1 1],'nomap')

Above I used brewermap because the default jet colormap is a bit garish, and rgb to get ocean blue. National borders are plotted with borders
Have you tried gridding your lat/lon arrays? Syntax would be
[long,latg] = meshgrid(lon,lat);
pcolor(long,latg,Z)
Not sure if gridding your lat/lons will fix the problem, but give it a shot.
Rong Yu
el 8 de Jun. de 2015
Chad Greene
el 9 de Jun. de 2015
The .bmp amd the .fig both look good for me. To be clear, the map looks good on your machine after you save it, but not in the Matlab figure window? If this is the case, try switching renderers. Type
set(gcf,'renderer','opengl')
If that doesn't work, try
set(gcf,'renderer','painters')
and if that doesn't work, try
set(gcf,'renderer','zbuffer')
Rong Yu
el 9 de Jun. de 2015
Mike Garrity
el 9 de Jun. de 2015
What version of MATLAB are you using? That looks like an issue that was fixed in R2014b. Is your version older than that, or newer?
Rong Yu
el 9 de Jun. de 2015
Respuesta aceptada
Más respuestas (1)
Chad Greene
el 8 de Jun. de 2015
0 votos
I see that when you use pcolor your axis values are not lat,lon values. Looks like linear indices of rows and columns. Are you sure you're plotting lat and lon?
Categorías
Más información sobre Repeated Measures and MANOVA en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!