From: FRUITS on
Hi All,

I have been trying to use pcolor for plotting but have had no success
for the past whole week. For example, if b1 and b2 are variables from
the numerical solution of a pde then I set

parameter1=linspace(.....);
parameter2=linspace(.....);

loop for parameter 1 and 2

D=b1-b2;
find(D<0)

pcolor(parameter1,parameter2, when is D negative )

Basically I want it to give the plot a green color if D is negative
only in the region 0<x<25, blue if D is negative only in 25<x<50,.....
and so on.

I very much appreciate it if someone can shed some light on this, as I
have been trying all week to get it right but no hope.

Cheers,

Emma
From: Walter Roberson on
FRUITS wrote:

> I have been trying to use pcolor for plotting but have had no success
> for the past whole week. For example, if b1 and b2 are variables from
> the numerical solution of a pde then I set
>
> parameter1=linspace(.....);
> parameter2=linspace(.....);
>
> loop for parameter 1 and 2
>
> D=b1-b2;
> find(D<0)
>
> pcolor(parameter1,parameter2, when is D negative )
>
> Basically I want it to give the plot a green color if D is negative
> only in the region 0<x<25, blue if D is negative only in 25<x<50,.....
> and so on.

You are trying to mix two modes of pcolor. pcolor() can color a matrix
on your behalf according to value if you give it only the matrix of
values; in that case that you supply x and y coordinates, then you must
supply a color value for each coordinate pair and so must pre-compute
the appropriate color values yourself.

What shape is D? is it length(parameter1) by length(parameter2) ?
From: FRUITS on
On Jun 1, 5:33 pm, Walter Roberson <rober...(a)hushmail.com> wrote:
> FRUITS wrote:
> > I have been trying to use pcolor for plotting but have had no success
> > for the past whole week.  For example, if b1 and b2 are variables from
> > the numerical solution of a pde then I set
>
> > parameter1=linspace(.....);
> > parameter2=linspace(.....);
>
> > loop for parameter 1 and 2
>
> > D=b1-b2;
> > find(D<0)
>
> > pcolor(parameter1,parameter2, when is D negative )
>
> > Basically I want it to give the plot a green color if D is negative
> > only in the region 0<x<25, blue if D is negative only in 25<x<50,.....
> > and so on.
>
> You are trying to mix two modes of pcolor. pcolor() can color a matrix
> on your behalf according to value if you give it only the matrix of
> values; in that case that you supply x and y coordinates, then you must
> supply a color value for each coordinate pair and so must pre-compute
> the appropriate color values yourself.
>
> What shape is D? is it length(parameter1) by length(parameter2) ?

Thanks for replying. Here is my basic code

param1s=linspace(....);
param2s=linspace(....);

Ldiff=[];

for j=1:length(param1s)
pars.param1=param1s(j);

for i=1:length(param2s)
pars.param2=param2s(i);

"run" my other program successively with those param1 and 2

D=b1-b2;
Ldiff(i,j)=length(find(D<0));
end
end

pcolor(param1s,param2s,double(Ldiff>0))


However, this is general and does NOT incorporate each range of x
(spatial variable) where D is negative a different colour.
From: us on
FRUITS <MA87(a)HOTMAIL.CO.UK> wrote in message <8eb9f4b5-feb1-4fd4-88b7-2dfcfd77085c(a)v37g2000vbv.googlegroups.com>...
> Hi All,
>
> I have been trying to use pcolor for plotting but have had no success
> for the past whole week. For example, if b1 and b2 are variables from
> the numerical solution of a pde then I set
>
> parameter1=linspace(.....);
> parameter2=linspace(.....);
>
> loop for parameter 1 and 2
>
> D=b1-b2;
> find(D<0)
>
> pcolor(parameter1,parameter2, when is D negative )
>
> Basically I want it to give the plot a green color if D is negative
> only in the region 0<x<25, blue if D is negative only in 25<x<50,.....
> and so on.
>
> I very much appreciate it if someone can shed some light on this, as I
> have been trying all week to get it right but no hope.
>
> Cheers,
>
> Emma

a hint:

help patch;

us
From: FRUITS on
On Jun 1, 5:54 pm, "us " <u...(a)neurol.unizh.ch> wrote:
> FRUITS <M...(a)HOTMAIL.CO.UK> wrote in message <8eb9f4b5-feb1-4fd4-88b7-2dfcfd770...(a)v37g2000vbv.googlegroups.com>...
> > Hi All,
>
> > I have been trying to use pcolor for plotting but have had no success
> > for the past whole week.  For example, if b1 and b2 are variables from
> > the numerical solution of a pde then I set
>
> > parameter1=linspace(.....);
> > parameter2=linspace(.....);
>
> > loop for parameter 1 and 2
>
> > D=b1-b2;
> > find(D<0)
>
> > pcolor(parameter1,parameter2, when is D negative )
>
> > Basically I want it to give the plot a green color if D is negative
> > only in the region 0<x<25, blue if D is negative only in 25<x<50,.....
> > and so on.
>
> > I very much appreciate it if someone can shed some light on this, as I
> > have been trying all week to get it right but no hope.
>
> > Cheers,
>
> > Emma
>
> a hint:
>
>      help patch;
>
> us

....but I am sure it can be done in pcolor rather than patch.