From 5c7d31157be682c03fac9c1944a942bbaaee30b1 Mon Sep 17 00:00:00 2001 From: Thomas Breloff Date: Tue, 26 Apr 2016 17:02:16 -0400 Subject: [PATCH] spy fixes; closes #196 --- src/recipes.jl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/recipes.jl b/src/recipes.jl index f8b70830..4bfcadb2 100644 --- a/src/recipes.jl +++ b/src/recipes.jl @@ -360,9 +360,11 @@ end "Sparsity plot... heatmap of non-zero values of a matrix" function spy{T<:Real}(z::AMat{T}; kw...) - # I,J,V = findnz(z) - # heatmap(J, I; leg=false, yflip=true, kw...) - heatmap(map(zi->float(zi!=0), z); leg=false, yflip=true, kw...) + mat = map(zi->float(zi!=0), z)' + xn, yn = size(mat) + heatmap(mat; leg=false, yflip=true, aspect_ratio=:equal, + xlim=(0.5, xn+0.5), ylim=(0.5, yn+0.5), + kw...) end "Adds a+bx... straight line over the current plot"