# [R] colour-plot of point intensities?

Greg Snow Greg.Snow at imail.org
Tue Dec 14 19:49:24 CET 2010

```Look at the hexbin package (bioconductor).

--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111

> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Matthew Vernon
> Sent: Tuesday, December 14, 2010 9:48 AM
> To: r-help at stat.math.ethz.ch
> Subject: [R] colour-plot of point intensities?
>
> Hi,
>
> I've spent a while scrabbling around at this problem, to no avail. I'm
> sure there /should/ be a simple answer...
>
> I have a large (14 million rows) data set, with two columns. Each row
> contains the number of times an individual moved, and the distance
> that individual moved in total. I would like a figure where the colour
> indicates the density of points, rather like this one my colleague
> produced in Matlab (with an older version of the data):
>
> http://www.warwick.ac.uk/~lssgah/warwick1.pdf
>
> Sadly, my colleague is away at the moment, so I can't find out what
> they did in Matlab. How should I be approaching this problem?
> [ideally, I'd like a colour-scale like that, too, but]
>
> My current approach, based on a bit in the back of Crawley's R book,
> was to create a new data file where I rounded distance off, and
> counted the number of similar rows to give a third column (a count). I
> then did:
>
> library(akima)
> zz <- with(obs,interp(V1,V2,V3))
> filled.contour(zz,col=heat.colors(12))
>
> But:
> i) I think doing a rounding step to create the third column (separate
> from the plot generation) is unwise
> ii) This results in a shaded area less than the full area of the plot
> iii) The colour comes out almost uniform
>
> I'd be grateful for any pointers.
>
> Thanks,
>
> Matthew
>
> --
> Matthew Vernon, Research Fellow
> Ecology and Epidemiology Group,
> University of Warwick
> http://blogs.warwick.ac.uk/mcvernon
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help