From: Rossella on
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 correspond to the rows and columns where the Density Matrix has been evaluated (i.e., a part of the original map)

What I obtained is a blue rectangle at the right position, but completely blue (instead of having different colors representing the different values in the density matrix). On the other side, if I plot in a new figure the pcolor plot, that is:
figure
pcolor(X,Y,SmoothedDensity);

the image I obtain is correct.

I really don't know what I'm doing wrong. One problem might be that the tiff image where I want to overlay the pseucolor plot is RGB, while the matrix that I'm plotting with pcolor is 2D. Another problem might be that the DensityMatrix is computed over a grid different to the number of original rows and columns (otherwise I would have very small numbers for each element of the density matrix), that is, each cell correspond to a group of rows and columns in the original image and I count the occurence of a specific event in the area described by that group of rows and columns.

I would really appreciate any help.
Thanks in advance.

Rossella