How to make the correlation values appear at a mapcolor?
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am trying to do the mapcolor of my correlation matrix, is it possible to make the correlations values appear at the mapcolor?
figure;
imagesc(RPEARSONIDHma,[-1 1])
colorbar
set(gca,'YTick', [1:11],'YTickLabel',{'1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11'})
set(gca,'XTick', [1:11],'XTickLabel',{'1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11'})
set(gcf,'Colormap',autumn)
0 comentarios
Respuestas (1)
Jayanti
el 10 de Oct. de 2024
Hi Julia,
You can use the “text” function to display the values of the correlation matrix in “mapcolor”. This function places text annotations at specified locations on the plot.
To display every value of the correlation matrix at “mapcolor”, use the "for" loop to iterate over the matrix. Below is the code you can refer to use “text” function.
text(j, i, sprintf('%.2f', RPEARSONIDHma(j, i)), ...
'HorizontalAlignment', 'center', ...
'VerticalAlignment', 'middle', ...
'Color', 'k');
Here i and j are the number of rows and columns of the correlation matrix “RPEARSONIDHma”. “sprintf” will format the value of correlation matrix to two decimal places. “HorizontalAlignment” and “VerticalAlignment” will display the text value at the center with a black color.
I am also attaching MathWorks documentation on “text” for your reference:
0 comentarios
Ver también
Categorías
Más información sobre Data Distribution Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!