【发布时间】:2015-01-09 15:29:47
【问题描述】:
我正在尝试使用两个不同的轮廓子图制作一个图表,这些子图使用完全不同的颜色图。但是,使用我目前拥有的代码(为其中一个子图创建自定义颜色图),子图具有相同的颜色图。任何想法如何解决这个问题?
h = figure;
subplot(2,1,1)
title('GEFS 20 Member Mean Vorticity');
axesm('eqdcylin','maplonlimit',[-180 179],'maplatlimit',[0 90]);
%eqdcylin
contourm(gLat, gLon, squeeze(meanhx(x,:,:))', 16,'Color',[0.05 0.05 0.05],'LineWidth',2);
hold on
contourfm(gLat, gLon, squeeze(vmeanx(x,:,:))', 30, 'LineStyle', 'none');
shading flat;
lm=worldlo('POline');
for i=1:length(lm);
lm(i).otherproperty = {'color','m','LineWidth',1.5};
end
displaym(lm);
gridm on;
tightmap;
set(h, 'Position', [1 1 2200 1100]);
colormap(b2r(-5*10^-5, 5*10^-5));
freezeColors;
cbfreeze(colorbar)
%caxis([-5*10^-5 5*10^-5])
colorbar;
subplot(2,1,2)
title('GEFS 20 Member Vorticity Variance');
axesm('eqdcylin','maplonlimit',[-180 179],'maplatlimit',[0 90]);
%eqdcylin
contourm(gLat, gLon, squeeze(meanhx(x,:,:))', 16,'Color',[0.05 0.05 0.05],'LineWidth',2);
hold on
contourfm(gLat, gLon, squeeze(vvarx(x,:,:))', 30, 'LineStyle', 'none');
shading flat;
lm=worldlo('POline');
for i=1:length(lm);
lm(i).otherproperty = {'color','m','LineWidth',1.5};
end
displaym(lm);
gridm on;
tightmap;
set(h, 'Position', [1 1 2200 1100]);
mycmap = [
0.9961 0.9961 0.9961;
0.6641 0.6641 0.9974;
0.3320 0.3320 0.9987;
0 0 1.0000;
0 0.2500 1.0000;
0 0.5000 1.0000;
0 0.7500 1.0000;
0 1.0000 1.0000;
0.2000 1.0000 0.8000;
0.4000 1.0000 0.6000;
0.6000 1.0000 0.4000;
0.8000 1.0000 0.2000;
1.0000 1.0000 0;
1.0000 0.9333 0;
1.0000 0.8667 0;
1.0000 0.8000 0;
1.0000 0.7333 0;
1.0000 0.6667 0;
1.0000 0.6000 0;
1.0000 0.5333 0;
1.0000 0.4667 0;
1.0000 0.4000 0;
1.0000 0.3333 0;
1.0000 0.2667 0;
1.0000 0.2000 0;
1.0000 0.1333 0;
1.0000 0.0667 0;
1.0000 0 0;
0.9854 0 0;
0.9708 0 0;
0.9561 0 0;
0.9415 0 0;
0.9269 0 0;
0.9123 0 0;
0.8977 0 0;
0.8830 0 0;
0.8684 0 0;
0.8538 0 0;
0.8392 0 0;
0.8246 0 0;
0.8099 0 0;
0.7953 0 0;
0.7807 0 0;
0.7661 0 0;
0.7515 0 0;
0.7368 0 0;
0.7222 0 0;
0.7092 0 0;
0.6961 0 0;
0.6830 0 0;
0.6699 0 0;
0.6569 0 0;
0.6438 0 0;
0.6307 0 0;
0.6176 0 0;
0.6046 0 0;
0.5915 0 0;
0.5784 0 0;
0.5654 0 0;
0.5523 0 0;
0.5392 0 0;
0.5261 0 0;
0.5131 0 0;
0.5000 0 0;
];
colormap(mycmap);
freezeColors;
cbfreeze(colorbar);
set(gcf, 'renderer', 'zbuffer');
【问题讨论】:
-
不是最小的,也不是可复制的;你看过 freezeColors 中的例子了吗?
-
当然可以,我怎样才能使这个最小化和可重现。
-
我多次搜索google,并继续返回相同的问题,因为似乎没有直接解决此问题的解决方案。否则我不会在这里问。此外,我不确定究竟是什么导致它无法重现,这里没有什么是不可重现的,而且代码只是一个杂乱的(带有映射线)轮廓图。
-
解决起来没那么简单,请看这里的解决方案:stackoverflow.com/a/39741044/2627163 如果你能制作一个我可以运行的独立代码,我会添加 2 个颜色图。
标签: matlab matlab-figure subplot contourf