The last two weeks of #tidytuesday have both involved data that can be spatially mapped. They were a good opportunity to get more familiar with showing information on states in the US or countries in Europe. Alternative fuel sources in the US The data for 2022-03-01 are fueling stations throughout the US that offer alternatives to gasoline or diesel. I used the usmap package to help plot this one: Code for this graphic is here Erasmus exchange program The data for 2022-03-08 come from the Erasmus+ exchange program. It allows students to travel to other countries. I decided to look at which countries received more students than they sent away.…
-
-
Visualize an interaction with ggplot
I've had to do this enough times (and have to look it up each time) that I decided to memorialize it here. The issue: I have a two-way repeated measures design and I want to visualize all four cells. I'd like one plot to contain the individuals responses as well as the cell means. But I also want to link individuals together. The solution: Plot the individual differences within each level of one of the factors using separate lines for each subject, plus an additional line for the cell means. Here's a simple demo (with a bonus example of how to simulate such a dataset).