From: adam Smith on
Hello:

I am trying to use the pcolor command in Matlab but cannot figure it out. What I want to obtain is a grid system consisting of 8 equal rectangular areas, where each rectangle has a different color compared to the others.

Can someone please help me write the code for this?

Thanks,
Adam
From: Steven Lord on

"adam Smith" <f_52(a)live.com> wrote in message
news:i0vd6i$j9d$1(a)fred.mathworks.com...
> Hello:
>
> I am trying to use the pcolor command in Matlab but cannot figure it out.
> What I want to obtain is a grid system consisting of 8 equal rectangular
> areas, where each rectangle has a different color compared to the others.
> Can someone please help me write the code for this?

Why don't you show us how you call PCOLOR and how you created the matrix
that you pass to PCOLOR?

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com


From: adam Smith on
"Steven Lord" <slord(a)mathworks.com> wrote in message <i0veu1$if4$1(a)fred.mathworks.com>...
>
> "adam Smith" <f_52(a)live.com> wrote in message
> news:i0vd6i$j9d$1(a)fred.mathworks.com...
> > Hello:
> >
> > I am trying to use the pcolor command in Matlab but cannot figure it out.
> > What I want to obtain is a grid system consisting of 8 equal rectangular
> > areas, where each rectangle has a different color compared to the others.
> > Can someone please help me write the code for this?
>
> Why don't you show us how you call PCOLOR and how you created the matrix
> that you pass to PCOLOR?
>
> --
> Steve Lord
> slord(a)mathworks.com
> comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com
>


I want to have node points on coordinates:
(0,0), (1,0), (2,0), (3,0), (4,0), (0,1), (1,1), (2,1), (3,1), (4,1), (0,2), (1,2), (2,2), (3,2), (4,2). I want the color between the nodes (0,0), (1,0), (0,1) and (1,1) to have color name = 1 and the next square having color name = 2 and so forth....

Well I am having difficulties defining the coordinates for the grid. This is what I have tried on just 4 squares which obviously is incorrect.

%%%%%%%%%%%%
clear, clc
x = [0 1; 0 1; 1 1; 2 2];
y = [0 0; 1 1; 0 1; 0 2];
z = [1 1; 1 1; 2 2; 2 2]; % color name
pcolor(x,y,z);
shading interp
%%%%%%%%%%%%

I think the problem is in the way I define the coordinates. Can someone suggest a better way of defining a 4 x 2 grid system with pcolor?