How to increase decimal places in corrplot function?
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have this code data = [ x y z]; % here original dataswere added
% Calculate the correlation matrix
corrMatrix = corr(data)
% Create a correlation plot
corrplot(corrMatrix,'type', 'Pearson','testR', 'on', 'varNames', {'TO', 'AN', 'TC%', 'TN%', 'C/N', 'F', 'M', 'Temp°C'});
and I got this graph but i want to increase the decimal places of the r2 values in the graph as it is showing the rounded off values. How can i change the code to do so.
0 comentarios
Respuestas (1)
Dyuman Joshi
el 26 de Sept. de 2023
Editada: Dyuman Joshi
el 26 de Sept. de 2023
load Data_Canada
[R,~,H] = corrplot(Data)
Here, H is the handle to the plotted graphics objects.
s = size(H);
%Indices of the elements of H to be modified
idx = find(~eye(s));
%Get the parent object of H
ax = get(H,'parent');
%Get the children of parent of H
ch = reshape(get([ax{:}],'Children'),s)
%Let's check the corresponding graphics
ch{2}
ch{2}(1)
The 'String' property of the 'Text' objects are the one you want to change.
for k=1:numel(idx)
%Change the text values to numbers in text form with 4 digits after decimal
set(ch{idx(k)}(1),'String',sprintf('%0.4f',R(idx(k))));
%Changing the font size
set(ch{idx(k)}(1),'FontSize',8)
end
2 comentarios
Ver también
Categorías
Más información sobre 2-D and 3-D 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!