I think you can use the continuous_color_gradient scale <http://gadflyjl.org/scale_continuous_color_gradient.html> element. So maybe something like:
spy(rand(5,5),Scale.continuous_color(minvalue = 0.1, maxvalue = 0.9)) Values that are outside the specified range will be black. You can also get more direct control over the colors by using the ContinousColorScale <http://gadflyjl.org/scale_ContinuousColorScale.html>. On Wednesday, November 19, 2014 12:36:23 AM UTC-8, JVaz wrote: > > Does anyone know how to fix the colors of the legend, independently of the > values to plot? For example, even if all the values of the matrix to plot > are 0, I still want the legend to go from -1 to 1, to keep all the > different plots uniform. > > I've been reading a lot here, but didn't find it: > http://dcjones.github.io/Gadfly.jl/geom_rectbin.html > > El viernes, 14 de febrero de 2014 09:38:16 UTC+9, Elliot Saba escribió: >> >> 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 >> >
