Custom heat maps- How to highlight a specific value in the heatmap
25 次查看(过去 30 天)
显示 更早的评论
I have a cell array of 6 cells (Mycell)
Each cell (i)containing 1486X492 points- each point is a value betwen 1 and -1 in decimal points.
I would like to plot this in a heatmap highligting only the points that are between 0.01 to -0.01
h = heatmap (Mycell{i});
I am not sure how to apply colour limits or any other better way to do this
Thanks
采纳的回答
Voss
2022-11-30
Maybe one of the following two approaches will be useful, depending on exactly what you want to see.
First, make up some data:
% some made-up data:
data = rand(25)*2-1; % uniform random on (-1,1)
data(randi(numel(data),[1 250])) = 0; % put some extra zeros in there
Approach 1: Use a custom colormap:
% this colormap will span values from -1 to 1
cmap = parula(200);
% make the range from -0.01 to 0.01 (i.e., the middle two rows)
% white in color, for highlighting:
cmap([100 101],:) = 1;
% create the heatmap
h = heatmap(data,'GridVisible',false);
% apply the colormap
colormap(cmap)
% apply the color limits (full range of the data)
clim([-1 1])
Approach 2: Use a standard colormap, but set the color limits to [-0.01 0.01]:
% some standard built-in colormap:
cmap = parula();
% create the heatmap
h = heatmap(data,'GridVisible',false);
% apply the colormap
colormap(cmap)
% apply the color limits (within the narrow range only
% - data outside this range map to the first or last color)
clim([-0.01 0.01])
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Green 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!