Colour not showing on particular points using pcolor plot - Matlab

Viewed 72

As the title states, I am stuggling to see the colours of two points of a mesh grid show up.

    %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

In the grid matrix I have 2 values top right and bottom left which I have set to -1 to signify that these are to be different colours; however, when this code is executed the colours of those respective spots remains the same as if if it was '0'. I added the colour bar to make sure that the scale was right and that if the values were -1 it 'should' be green.

Am I missing something really trivial here which is causing this from happening?

0 Answers
Related