Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Matlab colormap/colorbar range

  1. Jun 14, 2010 #1
    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?
     
  2. jcsd
  3. Jun 14, 2010 #2
    I think I found it, using "caxis([minvalue maxvalue])" before colorbar seems to be what I'm looking for.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Matlab colormap/colorbar range
Loading...