Histogram coloured by different hues in matlab

  • MATLAB
  • Thread starter physical101
  • Start date
  • #1
Dear Physics fans,

Are we all okay? I hope so.

I was wondering if you could help me please?

I am banging my head against a wall in matlab and I think what I need to do should be very easy.

I have a histogram of intensities and I could like to colour then starting off at black and getting progressively closer to red as it reaches the maximum.

Any advice, hints or tips you could give would be lovely

Cheers

Duane
 

Answers and Replies

  • #2
One thing I think you could do but it seems very janky since it would be color coding each point individually (technically). You could have matlab calculate the range of your values and how many values there are and then relate each point to the intensity of red. For example you have 100 values ranging from 0-100, the color specification for red is [1 0 0] so have each value go at increments of 1/100; therefore, you could have the intensity equal to something like this [v/r 0 0] where v is the value of the point and r is the total range. You could turn this into a function and have this specified for each point, it should give you the change in color like you want but it seems like a big hassle and there should be an easier way out there that I don't know about.
 

Related Threads on Histogram coloured by different hues in matlab

  • Last Post
Replies
5
Views
16K
  • Last Post
Replies
3
Views
1K
  • Last Post
Replies
12
Views
983
Replies
0
Views
2K
  • Last Post
Replies
1
Views
1K
  • Last Post
Replies
3
Views
2K
Replies
1
Views
939
Replies
1
Views
4K
Replies
1
Views
6K
Replies
1
Views
2K
Top