How to get handle of corrplot?

13 visualizaciones (últimos 30 días)
Sepp
Sepp el 7 de Mzo. de 2016
Comentada: Adam Danz el 8 de Feb. de 2019
Hello
I'm using corrplot for creating a correlation plot of my data. This works fine but I have two problems with it:
1. How can I get a handle of the figure so that I can change the figure size (full screen) and changing the font sizes? h = corrplot(...) and also gca does not work.
2. The diagonal represents the histograms. Unfortunately, my data has a pretty large tail, that means there are some few data points far right on the x-axis. That's why this histograms on the diagonal shows mostly nothing. So I think I have to decrease the x-axis limit for the histograms. How can I do this in corrplot?

Respuesta aceptada

Guillaume
Guillaume el 7 de Mzo. de 2016
Since corrplot does not return any figure handle you'll have to acquire it with gcf. Make sure that the correct figure is selected first.
hfig = gcf;
haxes = findobj(hfig, 'Type', 'Axes');
arrayfun(@(ax) xlim(ax, [your limits]), haxes); %to change all the axes limit
  3 comentarios
Sepp
Sepp el 8 de Mzo. de 2016
Editada: Sepp el 8 de Mzo. de 2016
I have managed to get it work:
hfig = gcf;
haxes = findobj(hfig, 'Type', 'Axes');
arrayfun(@(ax) xlim(ax, [your limits]), haxes); %to change all the axes limit
set(hfig ,'Name', 'Correlation Matrix', 'NumberTitle', 'off', 'units', 'normalized', 'outerposition', [0 0 1920 1080]);
set(hfig , 'Units', 'centimeters');
set(haxes , 'FontSize', 22, 'fontname', 'times');
There are only three last problems.
How can I also increase the size of the correlation numbers? I mean the number in each box.
How can I set different x-axis limits for each block (each column)?
How can I set different font sizes for the labels of the axis and the numbers (ticks) of the axis?
Adam Danz
Adam Danz el 8 de Feb. de 2019
A better way to get the axis handles in corrplot() is by using the 3rd output which is a matrix of plot object handles.
[~, ~, h] = corrplot(data);
haxes = [h.Parent];

Iniciar sesión para comentar.

Más respuestas (1)

Mustafa Khalid
Mustafa Khalid el 7 de Ag. de 2018
Hi Sepp,
To modify the size of the correlation numbers, do the following:
hfig = gcf;
textboxparent=findall(hfig,'Tag','scribeOverlay');
textboxchildren = get(textboxparent,'Children');
for hh=1:size(textboxchildren,1)
textboxchildren(hh).FontSize=16;
end

Categorías

Más información sobre Graphics Object Properties 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!

Translated by