Use pixel density as scale
Use pixel density as scale
(OP)
Hi!
I have a figure generated for the following code:
figure(1)
pcolor(X2,Y2,Z2)
shading interp
colormap(red)
colorbar('v')
X2, Y2 are map coordinates, and Z2 is the concentration of an air contaminant. The 'red' colormap gives a scale from RGB 1,0,0 to RGB 1,1,1.
But, instead of showing the scale in red changing hue to white, I would like to show the scale in density of red pixels. Does anyone know how?
Thanks in advance!
I have a figure generated for the following code:
figure(1)
pcolor(X2,Y2,Z2)
shading interp
colormap(red)
colorbar('v')
X2, Y2 are map coordinates, and Z2 is the concentration of an air contaminant. The 'red' colormap gives a scale from RGB 1,0,0 to RGB 1,1,1.
But, instead of showing the scale in red changing hue to white, I would like to show the scale in density of red pixels. Does anyone know how?
Thanks in advance!





RE: Use pixel density as scale
you can edit the colormap however you please. I think you might mean something like this ...
% start with a colormap of increasing grayscale density
c=colormap(gray);
c(:,[2:3])=0; % zero the green and blue entries
colormap(c); % load the custom colormap
CV
RE: Use pixel density as scale
I think maybe you understood the question.
But, with the code you submitted, I get a black figure.
I also get an error message:
Warning: One or more output arguments not assigned during call to 'colormap'
The code I use is:
figure(1)
pcolor(X2,Y2,Z2)
shading interp
c = colormap(gray)
c(:,[2:3]) = 0
colormap(c)
colorbar('v')
- MSV
RE: Use pixel density as scale
Hmmm. Maybe I have a default setting that is different from yours. Just to be sure your colormap is the same length, try this:
c = colormap(gray(256));
CV