function newspy(A) %NEWSPY Visualize the parity of the matrix % NEWSPY(A) plots % o reds for negative values % o blues for positive values % o greens for zeros [Iplus,Jplus] = find(A>0); % get the positive indices [Iminus,Jminus] = find(A<0); % get the negative indices [Izero,Jzero] = find(A==0); % get the zero indices figure;clf; % pull up a new figure and clear plot(Iplus,Jplus,'ro','MarkerFaceColor','r'); hold on; plot(Iminus,Jminus,'bo','MarkerFaceColor','b'); plot(Izero,Jzero,'go','MarkerFaceColor','g'); hold off; title([num2str(length(Iplus)) ' positive, '... num2str(length(Iminus)) ' negative, '... num2str(length(Izero)) ' zero']); axis([0 size(A,1)+1 0 size(A,2)+1]); set(gca,'ydir','reverse');