简体   繁体   中英

plotting parts of plotmatrix via plot handles

My code is the following:

A = [7 3 -1 1; -3 -9 3 7; -5 9 -7 -2; -2 4 -6 -2; 0 -3 8 2; 5 3 1 0; -10 10 -3 9; -6 8 9 -8; -6 2 -3 7; -2 2 2 -2; -9 0 -5 -1; 2 -5 2 -7; -2 10 -3 9; -5 -9 9 2; -8 7 6 -8; -3 -10 8 10];

[H,AX,BigAx,P,PAx] = plotmatrix(A);

graphics_toolkit fltk;

subplot(3,3,1)
plot(H(2))
subplot(3,3,2)
plot(H(3))
subplot(3,3,3)
plot(H(4))
subplot(3,3,5)
plot(H(7))
subplot(3,3,6)
plot(H(8))
subplot(3,3,9)
plot(H(9))

print -deps -mono p11c.eps

The function plotmatrix returns me a very nice plot of what I need - but I only need the upper right half of it. According to the docs, plotmatrix returns with H an array of plot handles, which can be plotted using plot .

However, executing this code results in 6 empty plots with weird axis, whereas the plotmatrix calls returns the correct plots.

What did I do wrong?

H represents the handles of the individual graphics objects, not the data (see documentation ). To do what you want, you need:

figure
subplot(3,3,1)
plot(get(H(2),'XData'),get(H(2),'YData'),'.')
subplot(3,3,2)
plot(get(H(3),'XData'),get(H(3),'YData'),'.')
subplot(3,3,3)
plot(get(H(4),'XData'),get(H(4),'YData'),'.')
subplot(3,3,5)
plot(get(H(7),'XData'),get(H(4),'YData'),'.')
subplot(3,3,6)
plot(get(H(8),'XData'),get(H(4),'YData'),'.')
subplot(3,3,9)
plot(get(H(9),'XData'),get(H(4),'YData'),'.')

BTW, I am not convinced that H is ordered the way you think it is. You might want to check that the data corresponds the bit of the matrix you are expecting.

This not really answer the question, but this code does what I needed:

for i = 1:3
    for j = i+1:4
        subplot (3, 3, (i-1)*3+(j-1));
        scatter (A(:,i), A(:,j));
    end
end

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM