Adjusting the colorbar to zero value
22 views (last 30 days)
Show older comments
Hei,
So I have a problem that is giving me a terrible headache. I have data that I am contouring using CONTOURF. It's ground temperature data. X,Y,Z is Time, Depth, Temp. I know that every time I contour the data I can use the colorbar adjuster to set the colorbar to what I need (which is blue for colds and reds for above zero). Essentially I want to remove the green color and set the transition from blues to reds to be at the zero degree isotherm. Now I tried making a small funtion that would create a colormap that is the color I want, using the min and max values from the Z data. But it just doesn't quite get lined up with the zero degree isotherm. I realized this is because the colorbar uses its own method for determining what values get what colors and it never has zero sitting right on the transition from blues to reds. Does anyone know how to do something along these lines? Or if you have some suggestions I'd appreciate it.
Jordan
0 Comments
Answers (1)
Grzegorz Knor
on 6 Dec 2012
I'm not sure if I good understand your problem, but maybe caxis function will be helpful:
contourf(peaks+10)
cmap = jet(255);
cmap(:,2) = 0;
colormap(cmap)
caxis([0 18])
colorbar
0 Comments
See Also
Categories
Find more on Purple in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!