フィルターのクリア

Adjusting the colorbar to zero value

16 ビュー (過去 30 日間)
Jordan Mertes
Jordan Mertes 2012 年 12 月 6 日
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

回答 (1 件)

Grzegorz Knor
Grzegorz Knor 2012 年 12 月 6 日
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

カテゴリ

Help Center および File ExchangeColormaps についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by