If image(gridData) works, then image(xbrks, ybrks, gridData) should work as well, and plot with the correct spatial coordinates - this assumes that xbrks and ybrks correspond to the dimensions of gridData - either exactly (the centres) or longer by one element (the corners).
In the sp package you can do x <- image2Grid(list(x = xbrks, y = ybrks, z = gridData)) to get a SpatialGridDataFrame, and then with maptools you can easily convert to spatstat's "im": library(maptools) x.im <- as.im(x) Either of those will help to plot or image() the data in the proper space and overplot points. Cheers, Mike. On Thu, Mar 31, 2011 at 2:21 PM, <stepen.cond...@gmail.com> wrote: > Hi all, > I have the following datasets and am trying to generate a spatial grid which > can be plotted (somewhat like the object created by spatstat's quadratcount): > > Dataset 1: A table containing a known number of cells, each value relating to > the intensity at a given cell. > >> str(gridData) > table [1:250, 1:400] 0 0 0 0 0 0 1.72 0 0 0 ... > - attr(*, "dimnames")=List of 2 > ..$ : chr [1:250] "A" "B" "C" "D" ... > ..$ : chr [1:400] "A" "B" "C" "D" ... > > Datasets 2&3: vectors of xbreaks and ybreaks - specifying the eastings and > northings of the grid cells I want to plot. > >> str(xbrks) > num [1:401] 1740000 1740100 1740200 1740300 1740400 ... > >> str(ybrks) > num [1:251] 5420000 5420100 5420200 5420300 5420400 ... > > > Given these three datatsets, what would be the easiest way to turn this into > a plottable (spatially located) grid, that I can then overlay ppp onto? > > I am aware that I can simply plot the table as an image, but obviously this > is not spatially referenced in anyway so I wouldn't then be able to overlay a > point data set and allow the pts and grid polygons to interact. > > Any assistance is greatly appreciated. > Stepen > _______________________________________________ > R-sig-Geo mailing list > R-sig-Geo@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-geo > -- Michael Sumner Institute for Marine and Antarctic Studies, University of Tasmania Hobart, Australia e-mail: mdsum...@gmail.com _______________________________________________ R-sig-Geo mailing list R-sig-Geo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo