Adjusting the colorbar to zero value

24 visualizaciones (últimos 30 días)
Jordan Mertes
Jordan Mertes el 6 de Dic. de 2012
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

Respuestas (1)

Grzegorz Knor
Grzegorz Knor el 6 de Dic. de 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

Categorías

Más información sobre Purple en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by