Sparse matrix graph matlab

I have a 5000 * 5000 resolved matrix with 4 different values. I want to visualize non-zero elements with four different colors so that I can find out the relationship of these values ​​and the relationship between them, I use imagesc , but I can’t recognize very well among different values, especially values ​​with a lower ratio. I think that if I use some characters for each value, it works, but I do not know how this happens in Matlab. Any suggestion? The result of Dan code is given below.

results of about 5000 * 5000result of 1000 * 1000 block of 5000 * 5000 matrix

+1
source share
2 answers

[X, Y, F] ( ):

, M

[X, Y] = meshgrid(1:size(M,1), 1:size(M,2));
Mf = M(:); %used again later, hence stored
V = [X(:), Y(:), Mf];

V(Mf == 0, :) = [];

, , gscatter(V(:,1), V(:,2), V(:,3)), , , :

M

Vu = unique(V(:,3));

xy, , , ..

hold all;
for g = 1:length(Vu)
    Vg = V(V(:,3)==Vu(g),:)
    plot(Vg(:,1), Vg(:,2), '*');
    a{g}=num2str(Vu(g));
end
legend(a);

M:

M = zeros(1000);
M(200,30) = 7;
M(100, 900) = 10;
M(150, 901) = 13;
M(600, 600) = 13;

:

enter image description here

+2

. , -

sum(histc(A, unique(A)),2)

.

temp = histc(A, unique(A)) "- ." , unique(A), A.

stat = sum(temp,2), unique(A) .

, @Dan, .

hold all; 
u=unique(A);
for i = 1:length(stat) 
plot(u(i), stat(i)/max(stat), '*');
end

, ?

0

All Articles