Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: spy() function #40

Closed
joshday opened this issue Oct 4, 2015 · 8 comments
Closed

Feature Request: spy() function #40

joshday opened this issue Oct 4, 2015 · 8 comments

Comments

@joshday
Copy link
Contributor

joshday commented Oct 4, 2015

Hi Tom. Matlab has a spy() function for viewing the sparsity pattern of a matrix. I like the way Gadfly implements spy(), which is to make a heatmap from a matrix (JuliaLang/julia#2121). I didn't see a way to do this through the Plots.jl api.

@joshday joshday changed the title Feature Requests: spy() function Feature Request: spy() function Oct 4, 2015
@tbreloff
Copy link
Member

tbreloff commented Oct 5, 2015

I wrapped the call to heatmap. Available on master for Gadfly, Immerse, PyPlot, Qwt:

screen shot 2015-10-04 at 9 40 22 pm

@tbreloff tbreloff closed this as completed Oct 5, 2015
@ptoche
Copy link

ptoche commented Jun 2, 2017

Any ideas? Thanks.

workspace()
SM = eye(5)
SM[end, end] = -1
using Gadfly
spy(SM)

WARNING: both Gadfly and Base export "cross"; uses of it in module Main must be qualified

Also tried the following, but no plot was produced.

p = spy(SM)
display(p)

Julia + Plots updated as of a few minutes ago.

@mkborregaard
Copy link
Member

mkborregaard commented Jun 2, 2017

Hi @ptoche - if you find an issue, it is better to open a new issue than comment on an old closed one, especially if the problem is different. We don't keep track of closed issues, so problems will not be solved. If you just have a question, the gitter channel is a good place to find us.

It does indeed look like the spy recipe is broken, and you should probably open a new issue, preferably with a screenshot detailing your problem.

However, your code would never work. You're calling Gadfly, but gadfly is no longer a Plots backend, and also you cannot call a Plots backend with using. For Plots, the code would look like this:

using Plots; gr() #call the GR backend
SM = eye(5)
SM[end, end] = -1
spy(SM)

@mkborregaard
Copy link
Member

spy isn't implemented as a heatmap anymore, BTW. You can just do a heatmap if that's what you'd like.

@ptoche
Copy link

ptoche commented Jun 2, 2017

@mkborregaard, thanks for your reply. I wasn't sure it was an 'issue' as such or my misunderstanding of the plotting syntax. Apparently both.

I had some Matlab code that used the spy() function, so I googled for Julia+spy and got here pretty quickly, which is why I left a message here. Other trails led me to using-spy-in-julia, but that didn't help much.

Okay, so I'll open an issue. Feel free to close it ;-)

@alanedelman
Copy link

so what's the good way to get spy with squares and not invisible dots?
(and matrix coordinates please?)

@joshday
Copy link
Contributor Author

joshday commented Oct 9, 2017

Try something like spy(x, marker = (:square, 5)) or heatmap(x, yflip = true)

@mkborregaard
Copy link
Member

Yes the markers are set very small by default in spy, so as not to overlap with the functionality of heatmap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants