Re: [R] Need frequency distribution for x,y coordinates

From: Jim Lemon <bitwrit_at_ozemail.com.au>
Date: Sun 12 Feb 2006 - 14:12:10 EST


mark shanks wrote:
>
> Hi,
>
> I have a set of data in x,y coordinates across the range of -5 to 5
in each
> dimension. I would like to obtain the frequency distribution of the
> different points, and then graph them so you can see which of the
points are
> the most frequently occurring.
>
> This would seem to be easy in Matlab, which has the hist3 command for
doing
> frequency distributions/histograms in 3 dimensions. However, as far
as I can
> tell, R does not have a hist3 command.

If a 2D display is okay, you can use the color2D.matplot function in the plotrix package to plot the output of something like kde2d in MASS:

x<-seq(-5,5,by=0.1)
xdens<-kde2d(sample(x,500,TRUE),sample(x,500,TRUE),n=11) color2D.matplot(xdens$z,c(1,0),c(0,1),c(0,0), show.legend=TRUE,xlab="Columns",ylab="Rows")

Jim



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Feb 21 08:40:46 2006

This archive was generated by hypermail 2.1.8 : Tue 21 Feb 2006 - 14:38:23 EST