I think Geom.rectbin <http://gadflyjl.org/geom_rectbin.html> might be what you are looking for. You'll need to split you data into two arrays of x and y positions, or four arrays of x_min, x_max, y_min, y_max positions for better control. If you don't care about the exact positioning, it might be even easier to convert your data into a 2D matrix then use the spy() function.
coords = Int64[x[j] for x in L, j in 1:2] plot(x = coords[:,1], y = coords[:,2], Geom.rectbin, Scale.x_discrete, Scale .y_discrete) or x_max = Float64[x[1] + 0.5 for x in L] x_min = Float64[x[1] - 0.5 for x in L] y_max = Float64[x[2] + 0.5 for x in L] y_min = Float64[x[2] - 0.5 for x in L] plot(x_max = x_max, x_min = x_min, y_max = y_max, y_min = y_min, Geom. rectbin) On Thursday, November 27, 2014 8:49:36 PM UTC-8, Alexander Gruber wrote: > > I have a big list of rectangles I'd like to draw. What I want is to end up > with something that looks like ArrayPlot > <http://reference.wolfram.com/language/ref/ArrayPlot.html> in Mathematica. > > I have it the data the form of an Array{(Int64,Int64),1}, where each entry > is the center of the rectangle. I have figured out that I can get a Vector > of rectangles by > map(x->rectangle(x[1],y[1],1,1)) > but I can't figure out how to actually plot these once I have them. How > do I turn the array of rectangles into an image? I've used the following > before (calling my list of points L) > draw(SVG("output.svg",20cm,20cm),plot(x=map(x->x[1],L),y=map(x->x[2],L))) > to output the points as point objects to a file, but I can't seem to > modify this syntax to work for the rectangle objects. > > (As a side note, I would also be interested in knowing how to get the > rasterized version of this, i.e. convert single pixels at coordinates > corresponding to L to black and leave the rest white. But even the vector > graphics part is turning out to be harder than expected, so maybe that will > have to be an adventure for another day...) >
