问题描述
正如标题所述,我正在努力查看网格网格的两个点的颜色。
%Generate the X and Y grid arrays using the MESHGRID function.
x = [1:11];
y = [1:10];
[X,Y] = meshgrid(x,y)
%Note that size(Z) is the same as size(x) and size(y)
grid = [1 0 0 1 1 0 1 1 1 0 -1;
1 1 0 0 1 0 1 1 0 0 1;
1 1 1 0 1 0 0 0 0 1 1;
1 1 1 0 1 0 1 1 1 1 1;
0 0 0 0 0 0 0 0 0 0 0;
1 1 1 0 1 0 1 1 1 1 1;
1 1 0 0 0 0 0 0 0 0 0;
1 0 0 0 1 1 1 0 1 1 1;
0 0 0 1 1 0 0 0 0 1 1;
-1 0 1 1 1 0 1 1 0 1 1]
C_1 = [0 1 0; 1 1 1; 0 0 0;]; % user defined colour map
colormap(C_1); % creates the colour map
%plot the figure
pcolor(X,Y,grid);
colorbar % adds a colour bar to check I am not going mental
caxis([-1 1]) % set colour limits
在网格矩阵中,我在右上角和左下角有2个值,我将它们设置为-1,以表示它们将是不同的颜色;但是,执行此代码时,这些相应斑点的颜色将保持相同,就好像它是“ 0”一样。我添加了颜色栏以确保比例正确,并且如果值是-1,则“应该”为绿色。
我在这里错过了一些琐碎的事情吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)