Re: [R] Kind of 2 dim histogram - levelplot

From: Deepayan Sarkar <deepayan.sarkar_at_gmail.com>
Date: Wed 06 Jul 2005 - 08:05:18 EST

On 7/5/05, Hans-Peter <gchappi@gmail.com> wrote:
> Dear R-List,
>
> I've written some code to put measurement values at a position x and y
> in bins (xb and yb). It works, but I wonder if there isn't a function
> that would do what I do by hand in "# fill data in bins"?

Here's one way:

tab = table(cut(x, breaks = 1:4), cut(y, breaks = 4:7)) levelplot(tab, xlim = rownames(tab), ylim = colnames(tab))

You might also want to try the hexbin package, which does hexagonal binning as opposed to rectangular binning here.

Deepayan



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 Wed Jul 06 08:08:16 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:33:16 EST