Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use pixel density as scale

Status
Not open for further replies.

moonmann

Civil/Environmental
Joined
Mar 5, 2007
Messages
2
Location
NO
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!
 

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
 
Hi! Thanks for the attention!

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
 

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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top