COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### pcolor in Matlab

• Email
• Follow

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
 0
Reply MA87 (38) 6/1/2010 4:14:57 PM

See related articles to this posting

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) ?
 0

On Jun 1, 5:33=A0pm, Walter Roberson <rober...@hushmail.com> wrote:
> FRUITS wrote:
> > I have been trying to use pcolor for plotting but have had no success
> > for the past whole week. =A0For example, if b1 and b2 are variables fro=
m
> > the numerical solution of a pde then I set
>
> > parameter1=3Dlinspace(.....);
> > parameter2=3Dlinspace(.....);
>
> > loop for parameter 1 and 2
>
> > D=3Db1-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=3Dlinspace(....);
param2s=3Dlinspace(....);

Ldiff=3D[];

for j=3D1:length(param1s)
pars.param1=3Dparam1s(j);

for i=3D1:length(param2s)
pars.param2=3Dparam2s(i);

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

D=3Db1-b2;
Ldiff(i,j)=3Dlength(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.
 0

FRUITS <MA87@HOTMAIL.CO.UK> wrote in message <8eb9f4b5-feb1-4fd4-88b7-2dfcfd77085c@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
 0

On Jun 1, 5:54=A0pm, "us " <u...@neurol.unizh.ch> wrote:
> FRUITS <M...@HOTMAIL.CO.UK> wrote in message <8eb9f4b5-feb1-4fd4-88b7-2df=
> > Hi All,
>
> > I have been trying to use pcolor for plotting but have had no success
> > for the past whole week. =A0For example, if b1 and b2 are variables fro=
m
> > the numerical solution of a pde then I set
>
> > parameter1=3Dlinspace(.....);
> > parameter2=3Dlinspace(.....);
>
> > loop for parameter 1 and 2
>
> > D=3Db1-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:
>
> =A0 =A0 =A0help patch;
>
> us

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

FRUITS wrote:
> On Jun 1, 5:33 pm, Walter Roberson <rober...@hushmail.com> wrote:

>> What shape is D? is it length(parameter1) by length(parameter2) ?

> Thanks for replying.  Here is my basic code

>         D=b1-b2;

You have not indicated the shape of b1 or b2, so I cannot tell what
shape D is ?

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

Please be more specific about how you want to color the areas where D is
non-negative.

> Ldiff(i,j)=length(find(D<0));

Ldiff(i,j) = any(D<0);

would be more efficient.

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

Your pcolor has param1s in the first argument, the one for x, but your
double for loop indexes param1s in the outer loop, j, which you use as
the second index of Ldiff, which is normally the position used for y
rather than x. If the lengths of param1s and param2s are not the same,
then this will cause your pcolor() call to fail.

As you referenced x as being the variable you wanted to vary the color
over, we need you to be clearer about whether that is the first or
second index of Ldiff.
 0

On Jun 1, 6:17=A0pm, Walter Roberson <rober...@hushmail.com> wrote:
> FRUITS wrote:
> > On Jun 1, 5:33 pm, Walter Roberson <rober...@hushmail.com> wrote:
> >> What shape is D? is it length(parameter1) by length(parameter2) ?
> > Thanks for replying. =A0Here is my basic code
> > =A0 =A0 =A0 =A0 D=3Db1-b2;
>
> You have not indicated the shape of b1 or b2, so I cannot tell what
> shape D is ?
>

sorry, b1 and b2 are the numerical solutions of my pde and when
plotted against x at steady state they look like a quadratic function.

> =A0> pcolor(param1s,param2s,double(Ldiff>0))
>
> Please be more specific about how you want to color the areas where D is
> non-negative.

I want to loop through "my other program" using param1(i) and
param2(j) and see if b1-b2 is becoming negative anywhere in my spatial
domain as the parameters are changing.  param(i) is varying for
example from 0 to 100 in 100 steps ... etc

>
> =A0> Ldiff(i,j)=3Dlength(find(D<0));
>
> Ldiff(i,j) =3D any(D<0);
>
> would be more efficient.

>
> =A0> pcolor(param1s,param2s,double(Ldiff>0))
>
> Your pcolor has param1s in the first argument, the one for x, but your
> double for loop indexes param1s in the outer loop, j, which you use as
> the second index of Ldiff, which is normally the position used for y
> rather than x.

thanks for pointing that out, I will double check it.

If the lengths of param1s and param2s are not the same,
> then this will cause your pcolor() call to fail.
>

The lengths are the same.  The pcolor is working, but it is not
exactly how I want it to present the results.

> As you referenced x as being the variable you wanted to vary the color
> over, we need you to be clearer about whether that is the first or
> second index of Ldiff.

maybe this is not so clear. The pcolor I want is param1 vs param2 vs
where D is negative.

Specifically, I want to include in the code not only if D is negative
or not, but where in the spatial domain is it negative.  E.g, If it is
negative where x<(somevalue) then colour it blue.  If it is negative
where x>(somevalue) then colour it red....etc

Note: I am not plotting x in the pcolor...x is only involved in my
"other program" that solves the set of pdes.

I hope it is a bit clearer now, thanks.

 0

FRUITS wrote:

>> Please be more specific about how you want to color the areas where D is
>> non-negative.

> I want to loop through "my other program" using param1(i) and
> param2(j) and see if b1-b2 is becoming negative anywhere in my spatial
> domain as the parameters are changing.  param(i) is varying for
> example from 0 to 100 in 100 steps ... etc

You indicated that when 0 < x < 25, you want negative values to be green, and
when 25 < x < 50, you want negative values to be blue. Now suppose I find a
point for which 0 < x < 25, but the point has no associated negative values:
what color should the point be colored? What if the point with no negative
values where in 25 < x < 50, then what color should it be colored? What if the
point has associated negative values but for the point, x is 25 _exactly_ and
thus does not fall into either the green region (which needs less than 25) nor
the blue region (which needs more than 25) ?

>> As you referenced x as being the variable you wanted to vary the color
>> over, we need you to be clearer about whether that is the first or
>> second index of Ldiff.
>
> maybe this is not so clear. The pcolor I want is param1 vs param2 vs
> where D is negative.
>
> Specifically, I want to include in the code not only if D is negative
> or not, but where in the spatial domain is it negative.  E.g, If it is
> negative where x<(somevalue) then colour it blue.  If it is negative
> where x>(somevalue) then colour it red....etc
>
> Note: I am not plotting x in the pcolor...x is only involved in my
> "other program" that solves the set of pdes.

Do I understand correctly that x is a variable involved in the section you
marked as "run my program with these parameters" ? That after that section of
code, we can count on x having a value? If so, then is x relatively easily
predictable based on the parameters (which might allow us to color sections of
the array at one time), or should x be treated as "sufficiently magic" in the
parameters that we should just do the color selection point by point?
 0

On Jun 1, 8:40=A0pm, Walter Roberson <rober...@hushmail.com> wrote:
> FRUITS wrote:
> >> Please be more specific about how you want to color the areas where D =
is
> >> non-negative.
> > I want to loop through "my other program" using param1(i) and
> > param2(j) and see if b1-b2 is becoming negative anywhere in my spatial
> > domain as the parameters are changing. =A0param(i) is varying for
> > example from 0 to 100 in 100 steps ... etc
>
> You indicated that when 0 < x < 25, you want negative values to be green,=
and
> when 25 < x < 50, you want negative values to be blue. Now suppose I find=
a
> point for which 0 < x < 25, but the point has no associated negative valu=
es:
> what color should the point be colored? What if the point with no negativ=
e
> values where in 25 < x < 50, then what color should it be colored? What i=
f the
> point has associated negative values but for the point, x is 25 _exactly_=
and
> thus does not fall into either the green region (which needs less than 25=
) nor
> the blue region (which needs more than 25) ?

This is exactly what I want to do.  I want to give any negative values
that happen to occur in the region  0 <=3D x <=3D 25 a specific color
(say,green), (as long as the negative points are in the region, it
does not matter how many negative points I have - i.e the length),
and the ones in the region 25 <=3D x <=3D 50 another color and 0 <=3D x <=
=3D
50 (ie. the whole x domain) another color.

If I dont have any negative values in any region I also want to give
it another color...so, in total I need to assign 4 different colors to
4 different cases.

I think it is fairly straightforward to implement, but I have had no
hopes with it so far.  Maybe someone can enlighten me, Thanks!

>
> >> As you referenced x as being the variable you wanted to vary the color
> >> over, we need you to be clearer about whether that is the first or
> >> second index of Ldiff.
>
> > maybe this is not so clear. The pcolor I want is param1 vs param2 vs
> > where D is negative.
>
> > Specifically, I want to include in the code not only if D is negative
> > or not, but where in the spatial domain is it negative. =A0E.g, If it i=
s
> > negative where x<(somevalue) then colour it blue. =A0If it is negative
> > where x>(somevalue) then colour it red....etc
>
> > Note: I am not plotting x in the pcolor...x is only involved in my
> > "other program" that solves the set of pdes.
>
> Do I understand correctly that x is a variable involved in the section yo=
u
> marked as "run my program with these parameters" ? That after that sectio=
n of
> code, we can count on x having a value? If so, then is x relatively easil=
y
> predictable based on the parameters (which might allow us to color sectio=
ns of
> the array at one time), or should x be treated as "sufficiently magic" in=
the
> parameters that we should just do the color selection point by point?

yes, x is just a spatial independent variable of the pde.
 0

FRUITS wrote:

> This is exactly what I want to do.  I want to give any negative values
> that happen to occur in the region  0 <= x <= 25 a specific color
> (say,green), (as long as the negative points are in the region, it
> does not matter how many negative points I have - i.e the length),
> and the ones in the region 25 <= x <= 50 another color and 0 <= x <=
> 50 (ie. the whole x domain) another color.
>
> If I dont have any negative values in any region I also want to give
> it another color...so, in total I need to assign 4 different colors to
> 4 different cases.

We are getting closer, but I do not understand the bit about the whole x
domain. You appear to be saying that when 0 <= x < 25, that you want to
color the point both the first color _and_ the third color, since 0 <= x
< 25 is also part of the range 0 <= x <= 50; likewise, 25 < x <= 50
should be colored both the second and third color, and 25 exactly, which
falls under all three conditions, should be all three colors simultaneous.
 0

On Jun 2, 4:25=A0am, Walter Roberson <rober...@hushmail.com> wrote:
> FRUITS wrote:
> > This is exactly what I want to do. =A0I want to give any negative value=
s
> > that happen to occur in the region =A00 <=3D x <=3D 25 a specific color
> > (say,green), (as long as the negative points are in the region, it
> > does not matter how many negative points I have - i.e the length),
> > and the ones in the region 25 <=3D x <=3D 50 another color and 0 <=3D x=
<=3D
> > 50 (ie. the whole x domain) another color.
>
> > If I dont have any negative values in any region I also want to give
> > it another color...so, in total I need to assign 4 different colors to
> > 4 different cases.
>
> We are getting closer, but I do not understand the bit about the whole x
> domain. You appear to be saying that when 0 <=3D x < 25, that you want to
> color the point both the first color _and_ the third color, since 0 <=3D =
x
> < 25 is also part of the range 0 <=3D x <=3D 50; likewise, 25 < x <=3D 50
> should be colored both the second and third color, and 25 exactly, which
> falls under all three conditions, should be all three colors simultaneous=
..

Let me say that again.  I loop through my "other program" using
params1 and params2.
If D is ALWAYS negative in the region from x=3D0 to x=3D50 (and say 50 is
the end of the spatial domain)
then I would give it a specific color.

If D is negative ONLY from x=3D0 to x=3D25 then I give it another color.

If D is negative ONLY from x=3D25 to x=3D50 then I give it another color.

If D is non-negative anywhere then I give it another color.

I just want to know how to color these regions using pcolor.
Please let me know if you need any clarifications.

 0

FRUITS wrote:

> Let me say that again.  I loop through my "other program" using
> params1 and params2.
> If D is ALWAYS negative in the region from x=0 to x=50 (and say 50 is
> the end of the spatial domain)
> then I would give it a specific color.
>
> If D is negative ONLY from x=0 to x=25 then I give it another color.
>
> If D is negative ONLY from x=25 to x=50 then I give it another color.
>
> If D is non-negative anywhere then I give it another color.

Is it the case that at each step, x is a vector of values, each in the
range 0 to 50 and that D is the same length as x, with each element of D
corresponding to the x in the same position? If so, then is x always a
full vector from 0 to 50, or does it sometimes cover only part of that
range? Is 25 certain to be at the mid-point of the vector of x? Is x
sorted in ascending order?

If x _is_ a vector of values ranging from 0 to 50, and if you want the
colors to be determined point-wise, then please clarify which color you
would want for the following cases:

- No D are negative

- some but not all D corresponding to 0 to 25 are negative, and no D
corresponding to 25 to 50 are negative

- all D corresponding to 0 to 25 are negative, and no D corresponding to
25 to 50 are negative

- no D corresponding to 0 to 25 are negative, and some but not all D
corresponding to 25 to 50 are negative

- some but not all D corresponding to 0 to 25 are negative, and some but
not all D corresponding to 25 to 50 are negative

- all D corresponding to 0 to 25 are negative, and some but not all D
corresponding to 25 to 50 are negative

- no D corresponding to 0 to 25 are negative, and all D corresponding to
25 to 50 are negative

- some but not all D corresponding to 0 to 25 are negative, and all D
corresponding to 25 to 50 are negative

That is 8 possible cases -- more if you wish to detect D equal to 0.

Please also decide (arbitrarily if necessary) which of the two sides you
want x exactly equal to 25 to fall into. It is computationally more
efficient if you have x exactly equal to 25 fall into the first half.

The alternative to all of this is that x is, after each run, a single
value that is in the range 0 to 50, and that you are asking that the
entire graph be colored one color if all of the D are negative at every
iteration, and that each location which ended up with an x from 0 to 25
be colored with a second color if all of the D are negative at those
locations, and that each location which ended up with an x from 25 to 50
be colored with a third color if all of the D are negative at those
locations. This leaves open the question of what colors you would wish
to use if somewhere in the graph, there was a location in which at least
one D was non-negative, and so on.
 0

11 Replies
504 Views

Similar Articles

12/5/2013 6:06:49 AM
page loaded in 108901 ms. (0)

Similar Artilces:

Bug in pcolor
Hello, I'am using the function pcolor ... but I've a problem with it For ex : pcolor(eye(3)) produces a map with only2 * 2 area; Is there a bug or am I stupid ? In the last case, what must I do to plot a map with 3 * 3 area ? Thanks for help Luc "Luc Dal" <dal@sped.ucl.ac.be> wrote in message news:cp4asc\$np0\$1@ail.sri.ucl.ac.be... > Hello, > > I'am using the function pcolor ... but I've a problem with it > For ex : pcolor(eye(3)) produces a map with only2 * 2 area; > Is there a bug or am I stupid ? Neither. From HELP PCOLOR: >> help pcolor PCOLOR Pseudocolor (checkerboard) plot. PCOLOR(C) is a pseudocolor or "checkerboard" plot of matrix C. The values of the elements of C specify the color in each cell of the plot. In the default shading mode, 'faceted', each cell has a constant color and the last row and column of C are not used. With shading('interp'), each cell has color resulting from bilinear interpolation of the color at its four vertices and all elements of C are used. *snip remainder of PCOLOR help* Note the third sentence in the help. So by default

pcolor in polar coordinates
Hi; I have some points on a circular surface and I might define a polar coordinates system which associates an angle and a radius to every point. I have then a pressure value for every point. What I'd like to do is to draw a map of the pressure distribution upon the circular surface. I think it's better if I work in polar coordinates but I still have some troubles...I know it may be simple, but I'm quite confused right now... How can I do it? I'd like to use the pcolor command, but surfc would be fine too. Thanx Lorenzo See example in matlab help: n = 6; r = (0:n)'/n; theta = pi*(-n:n)/n; X = r*cos(theta); Y = r*sin(theta); C = r*cos(2*theta); pcolor(X,Y,C) axis equal tight Use your preassure insted of C. Note X Y C is 2d equal size arrays. ----------------------------------------- Quaternions visualizations in Matlab: http://quaternion.110mb.com/ vedenev@ngs.ru Nobody? Please, is quite important...

Problems with getframe and pcolor
Hi all. My problem involves getframe and pcolor. I have been making plots of two different data types: one is plot particles made with the plot command and the other is a temperature profile made with the pcolor command. I have been taking theses plots and making them into movies with the getframe command. When I use the getframe command with the plots made with plot command everything works fine, but when I try to play a movie with the plots made with pcolor the frames are empty. I tried converting these frames to avi format and I still got a blank figure. Any idead on why pcolor plots aren't working with getframe but figures made with plot are?

render NaNs in pcolor
Hello, Matlab renders NaNs as blank/white in pcolor. I wonder if there is a way to have NaNs rendered as a different color (e.g., gray) that is not in the current colormap (e.g., jet). Thanks, David

Pcolor
Hi, Does anybody know how to turn off the grid in pcolor? grid off does not work. Thanks, S "susan" <suetibu@hotmail.com> wrote in message <gh9t95\$fb8\$1@fred.mathworks.com>... > Hi, Does anybody know how to turn off the grid in pcolor? grid off does not work. > > Thanks, > S shading flat shading interp should do the trick, Andrew "Andrew Stevens" <astevens@JUNKusgs.gov> wrote in message <gh9u5u\$2le\$1@fred.mathworks.com>... > "susan" <suetibu@hotmail.com> wrote in message <gh9t95\$fb8\$1@fred.mathworks.com>... > > Hi, Does anybody know how to turn off the grid in pcolor? grid off does not work. > > > > Thanks, > > S > > shading flat > shading interp > > should do the trick, > Andrew Thank you! "susan" <suetibu@hotmail.com> wrote in message <gh9t95\$fb8\$1@fred.mathworks.com>... > Hi, Does anybody know how to turn off the grid in pcolor? grid off does not work. > > Thanks, > S If you want to keep the pixel structure, you can use h=pcolor(peaks(42)) set(h,'edgecolor','none')

Pcolor in 3D cube
Hi all, I have draw a building (hollow cube) with the ground surface colored by using Pcolor command pcolor (RX,RY,atten). After i ran the code, i manage to get the color plot at ground floor. z-axis=0. I would like to another pcolor at z-axis=4.5, how do let my code to plot pcolor(RX,RY,atten_levelB) at z-axis=4.5?? %%Below was my code for attenuation plot. %%RX=x-axis %%RY=y-axis %%atten=attenuation factors pcolor(RX,RY,atten) hold on h=plot(tx(1),tx(2),'oy');%location of transmitter set(h,'markersize',mksize) %%plot the 3d cube of a building with partitions (represent by matrices) for ii =1:npt, h =plot3(Partition(:,1,ii),Partition(:,2,ii),Partition(:,3,ii)); set(h,'linewidth',linesize), end hold off colorbar xlabel('Width in meters'), ylabel('Depth in meters'), zlabel ('Hight in meters') title('Attenuation Factor') view(3)

pcolor, Transparency, renderer
Hi I have a pcolor plot, and I'm trying to superimpose a [semi-transparent] fill object on top. Here's the problem: -The only way to get transparency is by setting the renderer to 'OpenGL' -The only way to superimpose an object ON TOP of a pcolor object is to set the renderer to 'zbuffer'. The second point is really the killer, because I would think this shouldn't happen. But I've tried it with several configurations, and the result is always the same: I can superimpose an object over a pcolor object, but as soon as I set the renderer to 'OpenGL', the pcolor object goes on top. I've tried changing the order of the handles in the axes 'children' vector, no effect. I'm using version 7.4.0.287 (R2007a), for intel Mac. Please Help! Thanks! -Aaron Aaron wrote: > > > Hi > > I have a pcolor plot, and I'm trying to superimpose a > [semi-transparent] fill object on top. Here's the problem: > > -The only way to get transparency is by setting the renderer to > 'OpenGL' > > -The only way to superimpose an object ON TOP of a pcolor object is > to set the renderer to 'zbuffer

How to use pcolor in matlab in this example?
>> x=[1 2; 0 1] % defining 3 matrix x = 1 2 0 1 >> y=[1 0; 0 1] y = 1 0 0 1 >> z=[ 2 2 ; 1 1] z = 2 2 1 1 >> mesh(x,y,z) % 3D graph with mesh for the 3 matrix (x,y and z) >> k=1:1:100 % we want to plot the curves z=k with k integer number on the plane (x,y) >> contour(x,y,z,[k]) My question is how can I use pcolor for my 3 matrix? I tried : >> pcolor(x,y,z) I receive this error: ??? Attempt to execute SCRIPT surface as a function. Error in ==> pcolor at 76 hh = surface(x,y,zeros(size(c)),c,'parent',cax); "Sprinceana " > >> pcolor(x,y,z) > I receive this error: > ??? Attempt to execute SCRIPT surface as a function. > Error in ==> pcolor at 76 > hh = surface(x,y,zeros(size(c)),c,'parent',cax); a hint: - it seems you have a proprietary SURFACE function somewhere sitting around... which surface -all; % should show you the built-in us Thanks us!

help with graphics/colormap/pcolor or whatever
Hello, I have a question that I am hoping someone here can help me with. I have a 82*100 matrix and for each row, I want to specify a certain range of values (3 different ranges) a specific color AND these ranges change for each row. For example, say anything in (1,:) is between -400: -100 I want it to be blue, and anything between -100: 500 to be black, and anything between 500: 800 I want to be red. Then for (2,:), I have a different group of rangers to be those three colors. Does anyone have any idea how to do this? Thanks so much in advance, Tracy "tracy " <tracy

Overlaying a pcolor plot to a tif image
Hi, I'm trying to overlay a pcolor plot representing a density map over a tiff image (representing a map of a city), but when I do it, I obtain a wrong result. In particular, the tiff image is nxmx3 RGB uint8, while the density map that I want to plot with pcolor is a 2D matrix containing the density value in a selected subarea of the original map. If I plot in a new figure the density map with pcolor, the result is correct, but if I overlay it to the initial tiff image, I obtain a blue gridded rectangle (and all the other colors disappear). Basically, here's what I do: % Load and plot the tiff image Chicago_Map = imread('ChicagoMap.tif'); figure image(Chicago_Map); axis image axis off % Computation of the density matrix: I omit to write the code of this part because it is not relevant for the problem.The important thing is that at the end I have a 2D smoothed matrix (called SmoothedDensity) where each element represent the number of occurences of a certain event in that specific cell. Each cell correspond to a group of contiguos rows and columns. To overlay the pcolor to the first figure I do: hold on pcolor(X,Y,SmoothedDensity); % where X and Y