Skip to content
Prev 4945 / 29559 Next

plotting Football field ball pattern data

Miguel,

I am not entirely sure about what you need, but this might do it:

#install.packages("raster", repos="http://R-Forge.R-project.org")
require(raster)
# create a new raster. use additional arguments so that it matches
your data (extreme x and y )
r <- newRaster(ncols=36, nrows=18)

# I simulate 1000 points, 3 times (simulating not being able to load
all points, but perhaps you can, in this case)
n <- 1000
for (i in 1:3) {
	x <- runif(n)* 360 - 180
	y <- runif(n)* 180 - 90
	xy <- cbind(x, y)
	vals <- rep(1, n)
	r <- pointsToRaster(r, xy, vals)
	r[is.na(r)] <- 0
	if (i == 1) { rs <- r } else { rs <- rs + r }
}
# the plot you do not want:
plot(rs)
# is this the plot you do want?
x11()
plot(density(values(rs)))



Robert

On Fri, Jan 30, 2009 at 3:43 PM, Miguel Eduardo Gil Biraud
<miguel.gil.biraud at ieee.org> wrote: