How to use a suitable color bar?

Click For Summary

Discussion Overview

The discussion centers around the use of color bars in data visualization, particularly in the context of representing magnitude values through color gradients. Participants explore methods to enhance the visibility of data points with lower values while addressing issues related to color scaling in software like Matlab and Igor Pro.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant suggests that using a color bar with equal intervals results in a lack of distinction in lower value areas, proposing the idea of using exponentially increasing intervals instead.
  • Another participant mentions that while a non-linear color scale may not be directly available in Matlab, plotting the logarithm of the data could be a workaround.
  • A different viewpoint emphasizes that readers may prefer un-scaled data and expresses a desire to adjust the color bar without altering the underlying data.
  • One participant shares their experience with Igor Pro, which supports log color scaling, and points to a workaround found in a Matlab Central thread.
  • Another participant advises adjusting the color bar limits to better highlight the "interesting" range of values, suggesting a specific method to modify the color limits in Matlab.

Areas of Agreement / Disagreement

Participants express differing opinions on the best approach to color scaling, with no consensus on a single method. Some advocate for logarithmic scaling, while others prefer to maintain the original data values without rescaling.

Contextual Notes

Limitations include the lack of direct support for non-linear color scales in certain software and the potential need for data transformation, which may not be acceptable to all users.

kelvin490
Gold Member
Messages
227
Reaction score
3
I have a picture which shows the magnitude of some value in terms of color, like this one:

https://www.dropbox.com/s/yoh0n9cqftvrtlz/bar.jpg?dl=0

The higher the magnitude, the more it looks red. However there are only a few points at the edge has very high values and most of the points have much lower values. If a colorbar with equal intervals is used the picture just looks blue throughout and the values in most areas cannot be distinguished.

Is it possible to set a colorbar that has, say, exponentially increasing intervals (or others) so that the center part can also show different colors?
 
Physics news on Phys.org
I don't know of a way to ask Matlab to use a non-linear color scale, but you can remedy the problem by plotting, for instance, the log of your data instead of the raw data itself.
 
Readers are usually more comfortable with un-scaled data. Many other posts only offers solutions which requires scaling the data, but rescaling the colorbar without altering the data is more preferable. Thanks though.
 
One possibility is of course to use other software. I, for instance, use Igor Pro for plotting, and it does log color scaling.

Looking around, I found the following: http://ww.mathworks.com/matlabcentral/newsreader/view_thread/152310

The third message, dated 20 Jul, 2007 17:12:42, has a workaround.
 
Last edited by a moderator:
It looks like the figure is washed out at the bottom (blue), so you'll want to use a smaller max value. You'll want to play with the colorbar limits to find where the "interesting" range is, i.e. where the bottom values clipping to dark blue and the top values clipping to bright red are somewhat equalized.

You can change the colorbar limits this way (this example goes to 0.15 instead of 0.35, about half the range):

Code:
% Get a handle to the current figure object
ax = gca;

% Adjust the CLim property to use a different range of values for the colorbar.
% Scaled by 1e4 since it seems you use this scaling in your plot.
ax.CLim = 1e4*[0, 0.15];
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 3 ·
Replies
3
Views
8K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
22K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K