title: Using both color and size attributes in Hexagon Binning (ggplot2)
body: <p>I am hoping to construct some charts to display the shooting tendencies/effectiveness of some NBA players and teams. I would like to format the hexagons as follows: size will represent the number of shots and color will represent the relative efficiency (pts/attempt) from that location. <a href="http://courtvisionanalytics.com/wp-content/uploads/2012/07/RayAllen2012.jpg" rel="noreferrer">Here is a great example</a> of what I'm looking for, created by Kirk Goldsberry: </p>
  
  <p><img src="https://i.stack.imgur.com/sDUpz.jpg" alt="Ray Allen, by Kirk Goldsberry"></p>
  
  <p>I have been able to use <code>hexbins</code> and <code>hexTapply</code> to achieve something close to the desired result, but the shapes are circles. Here is my code (which includes sample data):</p>
  
  <pre><code>library(hexbin); library(ggplot2)
  df &lt;- read.table(text="xCoord yCoord   pts
  11.4     14.9     2
  2.6       1.1      0
  4.8       4.1      2
  -14.4    8.2      2
  4.2       0.3      0
  0.4       0.0     2
  -23.2   -1.1      3", header=TRUE)
  h &lt;- hexbin (x=df$xCoord, y = df$yCoord, IDs = TRUE, xbins=50)
  pts.binned &lt;- hexTapply (h, df$pts, FUN=mean)
  
  df.binned &lt;- data.frame (xCoord  = h@xcm, 
            yCoord  = h@ycm, FGA = h@count, pts = pts.binned)
  
  chart.player &lt;- ggplot (df.binned, aes (x =xCoord , 
                    y =yCoord , col = pts, size = FGA)) + coord_fixed() + 
  geom_point()  + scale_colour_gradient("Points/Attempt", low = "green", high="red")
  </code></pre>
  
  <p>Another way to think about it would be to coloring the hexagons in <code>plot(h, style="lattice")</code> by pts/attempt -- but I'm not sure how to do that, either.</p>
  
  <p>Is there a way to get this graph with hexagons rather than circles?</p>