Also, is there a way to get the axes to line up a little better? I want to tell spy() that it should start a 1 and not 0, as it seems to want to do. This is what it looks like right now:
I'd like to edit the xlabel and ylabel, but spy() doesn't seem to take in arguments, (only a matrix) and the Gadfly documentation doesn't seem to talk about how to modify a plot object after it's been created. On Thu, Feb 13, 2014 at 4:59 PM, Elliot Saba <[email protected]> wrote: > Great, spy() is exactly what I wanted! Is it documented anywhere, or did > I just miss it? > -E > > > On Thu, Feb 13, 2014 at 4:47 PM, Daniel Jones <[email protected]>wrote: > >> There's actually a special function "spy" to make plotting matrices >> simpler, where spy(M) returns a plot. All that function does is basically >> call findnz on the matrix and pass the result to x, y, and color in the >> regular plot function. >> >> Special handling of matrix arguments is something to consider though. >> >> On Thursday, February 13, 2014 4:38:16 PM UTC-8, Elliot Saba wrote: >>> >>> Hey there, I'm trying to use Gadfly's Geom.binrect to plot a matrix, but >>> I can't figure out how to do it without going through a lot of rigamarole >>> to generate a DataFrame like is used in the >>> example<https://github.com/dcjones/Gadfly.jl/blob/master/doc/geom_rectbin.md> >>> docs. >>> >>> I have, say, a 10x10 matrix: >>> >>> z = randn(10,10) >>> >>> In matlab, if I wanted to plot it, I would just imagesc(z). I know that >>> if I had a dataframe with a row for each point in z stored in a column, and >>> the x/y coordinates recorded in their own columns, I could coerce Gadfly to >>> plot what I want as shown in the example. But is there a simpler way to do >>> this? I've tried something like: >>> >>> plot(x=1:10, y=1:10, color=z, Geom.rectbin) >>> >>> But Gadfly just plots one pixel for each x and y passed in. I >>> understand why it's doing that, I just don't know the easiest way to get it >>> to treat z as a matrix, instead of a vector. >>> >>> Thanks, >>> -E >>> >> >
