9

I'm trying to plot a matrix with Gadfly, like I can do with PyPlot's matshow:

using PyPlot

p = eye(5)
p[5,5] = -1

matshow(p)

enter image description here

But I took a look at the docs, and found nothing. How can I do it with Gadfly?

4

1 回答 1

16

Gadfly has a spy() function which does the same thing.

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

You can check out the source for more information.

于 2014-07-06T19:00:35.797 回答