It’s been a while since I written anything, so figured I’d jump into my massive triage of partially written posts and finish one. Let’s talk hotdogs and ggplot.
This data contains the number of hot dogs eaten by contestant per date. The fields are self explanatory, but thought I’d point out two observations: the contest is held annually on the Fourth of July, and duration (probably time in minutes) dropped from 12 to 10 in 2008. We’re going to plot the number of hot dogs eaten per contestant over time, but first let’s see how many records we have for each year.
There aren’t many records before the 2008 competition, and looks like the womens division started in 2011. So for the sake of completeness, I’ll work with data between 2008-2020 (although it looks like there were only a few women who competed in 2020).
That’s a good start. But let’s clean up the axes and add a title.
Not bad, but let’s spice this up a bit. Joey Chestnut is well-known as the greatest eater in history. So let’s highlight his records.
This is better, but we don’t have a way to indicate that the red line is Joey Chestnut. Using the ggtext package, we can color “Joey Chestnut” in the subtitle to also serve as a legend. Here’s how:
Much better. Within thelabs ggplot layer I designated the size and color of the text within the <span> argument, then added plot.subtitle = element_markdown(lineheight = 0.5) in the theme layer. This is definitely one of my favorite ggplot tricks, now!
Update 2021-12-21
I realized it would be useful to link the ggtext package documentation, which has a ton of practical examples of incorporating text elements in ggplot labels.
The NHL season is on its mid-season break for the All Star game and I wanted to take a look at how teams have performed so far.
My goal was to learn somethi...
The MLS 2022 is nearing its end.
There are some clear front runners going into the playoffs, but I’ve started to wonder how teams offensive and defensive te...
The UEFA Champions League group draw is complete!
I’m very excited for this new season to start and for Real Madrid to defend their title.
Every season I k...
Hany Mukhtar is well on his way to an MLS MVP candidacy this season, so I wanted to take a look at Hany’s goal finishing ability.
I’ve recently gotten a lot...