首先发布在这里。 我有一堆xy数据(实际上是lats和longs),成功地绘制了每行的标量值。标量值介于0到0.5之间。创建一个色彩映射并在0到1之间运行,基于本地'秋季'地图。我从其他几篇文章中得到了这一点,不完全是我试图做的事情,但设法靠近为其他人提供的信息。现在的问题是图中出现的相对颜色条都是一种颜色吗?
这是我的剧本:
figure
% Define colormatrix
cols=flipud(autumn(1001));
% Interpolate the COL matrix to get colors for the data
tcols=interp1(0:0.001:1,cols,probS);
set(gcf,'DefaultAxesColorOrder',tcols);
colormap(tcols);
plot(xx,yy);
caxis([0,1])
c=colorbar;
它尝试附加图像以显示我的意思但被拒绝作为第一次使用者。 有趣的是,当我运行相同的脚本但用xy和标量值(probS)替换随机生成的数字时,颜色条的行为,例如,
close all;clear all
xx=rand(75,25)*10;
yy=rand(75,25)*10;
probS=sort(rand(75,1));
figure
% Define colormatrix
cols=flipud(autumn(1001));
% Interpolate the COL matrix to get colors for the data
tcols=interp1(0:0.001:1,cols,probS);
set(gcf,'DefaultAxesColorOrder',tcols);
colormap(tcols);
plot(xx,yy);
caxis([0,1])
c=colorbar;
任何建议或想法都会受到最高的赞赏。