清除 plotmatrix 的对角线图

Clearing the diagnal plots of the plotmatrix

考虑以下矩阵图

randdata = rand(1000,3);
[~,ax] = plotmatrix(randdata)

例如,如果我想清除诊断图,我使用以下方法

ClrIndx = find(eye(size(randdata,2)))

ClrIndx =

     1
     5
     9

cla(ax(ClrIndx))

但是 diagnol 图没有被清除,只是为了确定我比较了轴手柄

double(ax)

ans =

    0.0029    3.0029    6.0029
    1.0029    4.0029    7.0029
    2.0029    5.0029    8.0029

double(ax(ClrIndx))

ans =

    0.0029
    4.0029
    8.0029

这证实我有正确的轴手柄,但 cla() 命令仍然没有清除 diagnol 图,我做错了什么?

事实证明,plotmatrix 有很多轴魔法。看帮助,原来是用了多种辅助隐形轴。您需要清除最后一个:

[~,~,~,~,pax]=plotmatrix(randdata);
cla(pax(LinearClrIndex));

其中索引应该是线性的:在 5x5 矩阵图的情况下,pax 将是一个 5 元素数组。

如果你想删除轴,不仅仅是清除它,你还需要第二个输出:

randdata = rand(5)
[~,ax,~,~,pax]=plotmatrix(randdata);
delete(pax(2));
delete(ax(2,2));

这将在 (2,2) 位置留下一个空洞。