In case this helps, I wrote my own imshow() function a while back that 
copied spy() but took varargs and had more customizations explicitly 
included. It might fix the label problems or at least give you inspiration. 
 

function imshow(x, title::String="", units::String="", args...)
  is, js, values = findnz(x)
  m, n = size(x)
  df = DataFrames.DataFrame(i=is, j=js, value=values)
  plot(df, x="j", y="i", color="value",
         Coord.cartesian(yflip=true, fixed=true)
       , Scale.x_continuous(minvalue=0.5, maxvalue=n+0.5)
       , Scale.y_continuous(minvalue=0.5, maxvalue=m+0.5)
       , Geom.rectbin, Stat.identity
       , Guide.title(title) , Guide.colorkey(units)
       , Guide.XLabel(""), Guide.YLabel("")
       , Guide.xticks(ticks=[1,n]), Guide.yticks(ticks=[1,m])
       , Theme(panel_fill=color("black"), grid_line_width = 0inch)
       , args...)
end

On Thursday, November 13, 2014 9:09:37 AM UTC-6, Eduardo Lenz wrote:
>
>
>  Is there an equivalent in Winston ? 
>
> Thanks.
>
>
> On Thursday, February 13, 2014 10:47:50 PM UTC-2, Daniel Jones 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
>>>
>>

Reply via email to