sparse matrix - Getting different colors for different numbers using `spy` in Matlab -


when use spy check sparsity pattern, doesn't distinguish elements others. there way this? say, example, elements equal 10 red , elements equal 9 blue. can in 1 spy plot?

i've been able change size , style of plot points.

here how can it:

spy(a,'k') hold on spy(a==10,'r') spy(a==9,'b') hold off 

another way use scatter instead of spy :

[x,y] = find(a); clr = a(a~=0); scatter(x,y,[],clr) set(gca,'ydir','rev') 

in case points colored a values according current figure colormap.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -