How to Limit Colormap Range in Matlab Scatter Plot?

  • Context: MATLAB 
  • Thread starter Thread starter darkfall13
  • Start date Start date
  • Tags Tags
    Matlab Range
Click For Summary
SUMMARY

The discussion focuses on limiting the colormap range in Matlab scatter plots using the "caxis" function. Users can plot data points with a third variable represented by color by utilizing the scatter function (scatter(X,Y,S,C)). To restrict the color mapping to a specific range, such as -10 to 10, the "caxis([minvalue maxvalue])" command should be applied prior to invoking the colorbar. This ensures that values outside the specified range are represented by the last color in the colormap.

PREREQUISITES
  • Familiarity with Matlab programming environment
  • Understanding of scatter plot functions in Matlab
  • Knowledge of colormap and colorbar functionalities
  • Basic grasp of data visualization principles
NEXT STEPS
  • Explore advanced colormap techniques in Matlab
  • Learn about customizing scatter plot markers in Matlab
  • Investigate the use of "caxis" in other plotting functions
  • Study data normalization techniques for better visualization
USEFUL FOR

Data scientists, researchers, and engineers who utilize Matlab for data visualization and need to enhance the clarity of scatter plots by controlling color mapping.

darkfall13
Messages
30
Reaction score
0
I'm doing some plotting in Matlab where I'm using a third variable of data as a color. For example I have vectors x and y with some sort of values plotted as a scatter plot. I can color the points according to a third vector z by turning on colormap and colorbar (scatter(X,Y,S,C) and use z in place of C) and Matlab will take care of the color range and scaling.

But let's say z contains random values ranging from -25 to 25 then of course the ends of the colormap will be -25 and 25, but what if you want it to just end at say -10 and 10 so that all values outside of that range are the last color of the colormap?
 
Physics news on Phys.org
I think I found it, using "caxis([minvalue maxvalue])" before colorbar seems to be what I'm looking for.
 

Similar threads

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