×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Use pixel density as scale

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!

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

(OP)
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

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources