MATLAB: Is it possible to have a custom color bar colormapcustom color mapMATLAB Is it possible to have a custom color bar? Dear all, I have a pre-plotted figure, Is it possible to add a color bar from -25 to 5600. From light_brown = [0.95 0.9 0.8]; to brown_color = [0.8 0.2 0.1] to it? Best Answer Try this:grayImage = imread('cameraman.tif');% Rescale image to values -25 to 5600.grayImage = rescale(double(grayImage), -25, 5600);imshow(grayImage, []);light_brown = [0.95 0.9 0.8]; brown_color = [0.8 0.2 0.1];numColors = 256; % WhateverredMap = linspace(light_brown(1), brown_color(1), numColors);greenMap = linspace(light_brown(2), brown_color(2), numColors);blueMap = linspace(light_brown(3), brown_color(3), numColors);myColorMap = [redMap(:), greenMap(:), blueMap(:)];colormap(myColorMap);colorbar;caxis([-25, 5600]); Related SolutionsMATLAB: How to calculate the own colormap Make an N by 3 array. Sox = (0:255)';redMap = your red formula.greenMap = your green formulablueMap = your blue formulacMap = [redMap(:), greenMap(:), blueMap(:)];colormap(cMap); MATLAB: I have a transparent .png picture when I add it to the current figure the background of it changes to black! Read the transperancy map and use it to make the background transparent.% read small circle[img, ~, tr] = imread('test.png');im = image('CData',img,'XData',[50 52],'YData',[30 32]);im.AlphaData = tr;hold off Related QuestionGrid line not showing for y-axisHow to detemine the presence of some colors (e.g white, light brown, dark brown, red, blue gray and black) in a piture like attached oneHow to exclude preprocessed codes in Polyspace Code ProverPlot multiple lines with gradient gray hue
Best Answer