Creating specific grid lines for heatmap
Show older comments
Hi all,
I am creating a heatmap of correlations using the heatmap function. I have been able to toggle the grid property on and off, but am having difficulty trying specific grid lines where I need them. From what I've read, this is generally accomplished using XTick and YTick for graphing purposes, but when I try it here I get the following error:
Unrecognized property 'XTick' for class 'matlab.graphics.chart.HeatmapChart'.
What I am trying to do, for example, is create easily recognizable groups of hot spots. I've attached below the code and some figures (same data with either grid on or grid off) to try to illustrate the goal. Let's say I wanted horizontal and vertical grid lines after the 3rd row and 3rd column. How can I add these to my figure? Any assistance would be greatly appreciated!
HeatmapTest=[
0.0000 0.4230 0.5668 0.5079 0.4572
0.4230 0.0000 0.4343 0.4262 0.4703
0.5668 0.4343 0.0000 0.5535 0.5072
0.5079 0.4262 0.5535 0.0000 0.5099
0.4572 0.4703 0.5072 0.5099 0.0000];
labelsTest=categorical({'RH TO1/MT','RH vTO','RH LO1','RH V3A','RH hV4'});
figure(1)
fixMap=heatmap(FixheatmapTest2);
fixMap.Title='Fixation Community Structure';
fixMap.XData=labelsTest;
fixMap.YData=labelsTest;
fixMap.Colormap=jet;
% grid(fixMap, 'off')
caxis([0 1]);
figure(2)
fixMap=heatmap(FixheatmapTest2);
fixMap.Title='Fixation Community Structure';
fixMap.XData=labelsTest;
fixMap.YData=labelsTest;
fixMap.Colormap=jet;
grid(fixMap, 'off')
caxis([0 1]);


1 Comment
Adam Danz
on 16 Mar 2021
The problem with changing the xtick is that your tick labels will also be affected.
Accepted Answer
More Answers (0)
Categories
Find more on Data Distribution Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
