From: Jax Cao on 4 Aug 2010 14:48 Hi, Several weeks ago, I posted a message of worldmap issue: http://www.mathworks.com/matlabcentral/newsreader/view_thread/287296 I hope Matlab professionals look at the post to see whether it is possible to modify their original codes. Now I have another issue related with worldmap color presentation and look for a possible answer. I am not able to conserve colors using contourfm, contourm in the worldmap. I use 2007b but I guess the problem exists in other versions. Basically, color bands are distorted without freezeColors or removed after using freezeColors, a tool by John Iversen. Let me use the following example to illustrate, and I put the corresponding figures in the link: http://www.jaxforum.net/apps/photos/album?albumid=9673658 so you can compare your figures with mine: sz = get(0, 'screensize'); h = figure('position', [150 150 sz(3)*3/5 sz(3)*3/10]); axes1 = axes('parent', h, 'position', [0.04 0.06 .45 .88]); axes2 = axes('parent', h, 'position', [0.53 0.06 .45 .88]); y = rand(40, 1)*40 ; x = rand(40, 1)*80 ; z = sqrt((x-40).^2 + (y-20).^2); xlin = linspace(min(x),max(x),32); ylin = linspace(min(y),max(y),32); [X,Y] = meshgrid(xlin,ylin); Z = griddata(x, y, z, X, Y, 'cubic'); axes(axes1) h = worldmap([1 40], [1 80]); contourfm(ylin, xlin, Z, [25, 35 42]); colormap('Cool') axes(axes2) h = worldmap([1 40], [1 80]); contourfm(ylin, xlin, Z, [25, 35 42]); contourm(ylin, xlin, Z, 'k') Now the color changed, and if I use freezeColors before the contourm, the result is good without any distortion. i.e. replace contourm(ylin, xlin, Z, 'k') with the following two: freezeColors contourm(ylin, xlin, Z, 'k') However there are still some issues with freezeColors. For example, freezeColors will remove color bands if I set the white color as the worldmap background. Please see: figure h = worldmap([1 40], [1 80]); setm(h, 'FFaceColor', [1 1 1]); contourfm(ylin, xlin, Z, [25, 35 42]); % here use the data above colormap('Cool') freezeColors Now you will see that freezeColors remove the left cyan band. What's the problem? Thanks, Jax Cao
|
Pages: 1 Prev: Parallel Computing optimization Next: Fortran Ex. (Outputs 2 vectors to Matlab) with Mex file |