2

I'm afraid this is a slightly abstract question, but is there a way to use a metric other than 'count' in hexbin. My code to produce a hexbin chart would be something like:

library(hexbin)
hexbinplot(latitude~longitude,data=X)

Given that my output is essentially a map, I was wanting to replace 'count'and make the colours of the hexbins relate to a 3rd variable at the aggregate level, eg say I were looking at demographic data, then the 3rd variable might be aggregate or average consumer spending power of all those people belonging to a geographical region defined by the hexbin.

I understand that this would be possible by conditioning on a third variable in 2 windows in the normal lattice/trellis way, but I'm not sure it is possible to have a representation of something other than 'count' in the chart. Thanks for any help.

RichS
  • 659
  • 12
  • 19
  • 1
    What if you provide your third variable as `fill` in ggplot's binhex? http://docs.ggplot2.org/current/stat_binhex.html – Roman Luštrik Oct 13 '15 at 10:03
  • 1
    Take a look at the `use.count` and `cell.at` parameters to `grid.hexagons`. IIRC the vignette talks abt this case as well but I didn't check. – hrbrmstr Oct 13 '15 at 10:46

0 Answers0