                          .pointsize(rad)
                          .pointcolor(color)
 
+# function that actually makes the plot of one of the 4 sets
+#   - the URL passed to d3.json causes the request to the database, and data as JSON back
+#   - we remove previous plot and any d3-tip objects
+#   - then make the scatterplot
 make_plot = (set) ->
     d3.json("http://localhost:8080/anscombe/#{set}", (data) ->
         d3.select("svg#scatterplot").remove()

   .attr("fill", color)
   .on("mouseover", (d) -> d3.select(this).attr("fill", hilit))
   .on("mouseout", (d) -> d3.select(this).attr("fill", color))
   .on("click", (d) -> make_plot(d))

svg.selectAll("empty")
   .data(sets)
   .enter()

   .style("text-anchor", "middle")
   .style("font-size", "20px")

# function to create the scatterplot
# (see http://kbroman.org/d3panels)
myscatter = scatterplot().xvar("x")
                         .yvar("y")
                         .xlab("X")
