# Add label to sub-axes in plotmatrix

53 views (last 30 days)
Isabel Chen on 15 Mar 2015
Edited: Brendan on 22 Sep 2017
I am using the plotmatrix function and would like to label the sub-axes (along the major Y axis and X axis only, of course). I've managed to turn all the YTickLabels and XTickLabels off:
set(AX,'YTickLabel',[]);
but cannot figure out how to change the current axes from BigAx to the required subaxes in AX. I can manually add the labels using plotTools, but there must be a way to do this using code? I have a large-ish matrix (10x10 minimum) so it would a real help to be able to write a script to do this. Please help!!

Isabel Chen on 20 Mar 2015
Just in case anyone is interested,
ylabel(AX(1,1),'str1')
ylabel(AX(2,1),'str2')
xlabel(AX(8,1),'str3')
xlabel(AX(8,2),'str4')
does the trick.

#### 1 Comment

Brendan on 22 Sep 2017
The above suggestion doesn't work. This does.
X = randn(50,3);
Y = reshape(1:150,50,3);
[~,ax]=plotmatrix(X,Y);
ax(1,1).YLabel.String='Test1';
ax(2,1).YLabel.String='Test2';
ax(3,1).YLabel.String='Test3';
ax(3,1).XLabel.String='Test7';
ax(3,2).XLabel.String='Test8';
ax(3,3).XLabel.String='Test9';

Brendan on 22 Sep 2017
To create a sublabel on plotmatrix (on the outer subplots) use something like the following... The suggested answer above doesn't work.
X = randn(50,3);
Y = reshape(1:150,50,3);
[~,ax]=plotmatrix(X,Y);
ax(1,1).YLabel.String='Test1';
ax(2,1).YLabel.String='Test2';
ax(3,1).YLabel.String='Test3';
ax(3,1).XLabel.String='Test7';
ax(3,2).XLabel.String='Test8';
ax(3,3).XLabel.String='Test9';