How can I change only one color in my colormap?

I plot a 3dimensional temperature distribution via interpn in the whole space. so the data that are not defined by my input data appear as zero. to put them as NaN does not work for the programm to run. So i want to change the color for c=0 to white so it doesnt disturb the view. how can I do that?

 Akzeptierte Antwort

Image Analyst
Image Analyst am 11 Jun. 2015

2 Stimmen

Assuming the 0 value is the first row of your color map:
yourColorMap(1, :) = [1,1,1];

3 Kommentare

Julia Mödl
Julia Mödl am 11 Jun. 2015
thanks for the quick answer. i would like to use the colormap jet and just change the color for 0. is that possible?
Yes.
yourColorMap = jet(256);
yourColorMap(1, :) = [1,1,1];
colormap(yourColorMap);
colorbar;
Julia Mödl
Julia Mödl am 12 Jun. 2015
Thanks so much, works perfect! :)

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Color and Styling finden Sie in Hilfe-Center und File Exchange

Produkte

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by