title: Constructing a bubble trellis plot with lattice in R
body: <p>First off, this is a homework question. The problem is ex. 2.6 from pg.26 of An Introduction to Applied Multivariate Analysis. It's laid out as:</p>
  
  <blockquote>
    <p>Construct a bubble plot of the earthquake data using latitude and longitude as the scatterplot and depth as the circles, with greater depths giving smaller circles. In addition, divide the magnitudes into three equal ranges and label the points in your bubble plot with a different symbol depending on the magnitude group into which the point falls.</p>
  </blockquote>
  
  <p>I have figured out that symbols, which is in base graphics does not work well with lattice. Also, I haven't figured out if lattice has the functionality to change symbol size (i.e. bubble size). I bought the lattice book in a fit of desperation last night, and as I see in some of the examples, it is possible to symbol color and shape for each "cut" or panel. I am then working under the assumption that symbol size could then also be manipulated, but I haven't been able to figure out how.</p>
  
  <p>My code looks like:</p>
  
  <pre><code>    plot(xyplot(lat ~ long | cut(mag, 3), data=quakes,
          layout=c(3,1), xlab="Longitude", ylab="Latitude",
          panel = function(x,y){
            grid.circle(x,y,r=sqrt(quakes$depth),draw=TRUE)
          }
      ))
  </code></pre>
  
  <p>Where I attempt to use the grid package to draw the circles, but when this executes, I just get a blank plot. Could anyone please point me in the right direction? I would be very grateful!</p>