Exercise 6.3: Automating scatter plots


We will soon use HoloViews to quickly make scatter plots. Nonetheless, I think coding up your own function to make scatter plots with coloring based on a column of a tidy data frame will help you understand how high level plotting works (and also allow you to practice manipulating data frames).

a) Write a function that takes as input a tidy data frame and generates a scatter plot based on two columns of the data frame and colors the glyphs according to a third column that contains categorical variables. The minimal (you can add other kwargs if you want) call signature should be

scatter(data, cat, x, y)

b) Test out your function by using it to make a scatter plot of the adhesive force versus impact force from the frog tongue strike data set where you color the glyphs by the frog ID.