How to change heatmap xtick labels? Also, how to overlay (hold on) some dots over the heatmap?
Show older comments
My intention is to get a plot like this:

I have a matrix similar to that for which I want to plot the correlation coefficients and pvalue<0.05 in a similar manner.
This is the matrix: (4x5)
R=[0.1 0.3 0.5 0.7 0.9;0.1 0.2 NaN 0.4 0.5;0.1 0.3 0.2 NaN 0.1;0.1 NaN NaN NaN 0.9]; %Correlation coefficients
P=[0 0.2 0.2 0.4 0.02;0.1 0.2 NaN 0.4 0.5;0.1 0.3 0.2 NaN 0.1;0.1 NaN NaN NaN 0.9]; %P values
I wanted to plot this data similar to the image above with xticklabels too. I tried this:
heatmap(R);
xticks(1:5); % note that image's ticks are aligned to the faces, pcolor's are aligned to the vertices
xticklabels({'A','B','C','D','E'});
xticks(1:4); % note that image's ticks are aligned to the faces, pcolor's are aligned to the vertices
xticklabels({'A','B','C','D'});
hold on;
mask=P<0.05;
x=1:5;
y=1:4;
[X,Y]=meshgrid(x,y);
stipple(X,Y,mask);
Is there any other easy way to do the same? I also tried pcolor function but it interpolates the values rather than giving exact values.
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!
