# ggplot2

I have once again been inspired by a tweet! This one came from @WeAreRLadies, which was being moderated by Alison Hill at the time. Y'all there is a ggclock @rstudio #ggplot2 #rstats pic.twitter.com/pJHlIssQUS — We are R-Ladies (@WeAreRLadies) November 9, 2018 Alison was at RStudio headquarters in Boston, when she noticed a ggplot2 themed clock! To which I had a totally normal reaction. I decided that I must have one.

## Making an animated contour plot

Earlier this week Mike Bostock tweeted a interesting looking contour plot with a link to edit the formula and manipulate the graphic using D3.js. A live 2D function plot. Edit the function and reply with interesting images! https://t.co/joWfPgUAAU pic.twitter.com/XYhvJBavRM — Mike Bostock (@mbostock) September 3, 2018 I decided I would attempt to recreate the image using ggplot2, and animate it using the new gganimate package. Creating the data I started by creating a data frame with all the combinations of x and y on a grid between -10 and 10, in intervals of 0.

## Animated TIE Fighter

Recently I’ve been looking for an excuse to try out Thomas Lin Pedersen’s new grammar of animation, which is an extension of ggplot2 and a retooling of the existing gganmiate package. You can find the new package here. Luckily for me, Rafael Irizarry provided the perfect inspiration: Happy #MayFourth #rstats par(bg=1,fg="white") x<-0.5->y z<-"|-o-|" s<-cbind(runif(50),runif(50)) m<-c(-1,1)/20 while(TRUE){ rafalib::nullplot(xaxt="n",yaxt="n",bty="n") points(s,pch=".") text(x,y,z, cex=4) x<-pmin(pmax(x+sample(m,1),0),1) y<-pmin(pmax(y+sample(m,1),0),1) } pic.twitter.com/2kBwklMjTy — Rafael Irizarry (@rafalab) May 4, 2018 So in honor of Star Wars day, I decided to create Rafael’s TIE fighter GIF using the new gganimate.

## Creating an EM:IP Cover Graphic Using ggplot2

This time last year, I submitted a graphic to the Educational Measurement: Issues and Practice (EM:IP) cover showcase competition. In April at the annual National Council on Measurement in Education conference, it was announced that I was one of four winners that would be featured on the cover of EM:IP this year. Earlier this week, the issue with my graphic was released! The graphic demonstrates how different levels of compensation in multidimensional item response theory models (MIRT).

## Visualizing different levels of compensation in multidimensional item response theory models

This graphic shows the probability of providing a correct response to an item in a multidimensional item response theory (MIRT) model. The colors represent the probability of a correct response, and the contours represent chunk of 10% probability …

## Tidy Sports Analytics, Part 3: ggplot2

This is the third post in the tidy sports analytics series. In this series, I’ve been demonstrating how the collection of tidyverse packages can be used to explore and analyze sports data. Specifically, I’ve been using the 2016 NFL play-by-play data from Armchair Analysis. Part one in the series showed how dplyr can be used for data manipulation, and part two demonstrated reshaping and tidying data using tidyr. This post focuses on data visualization using ggplot2.

## Recreating the Datasaurus Dozen Using tweenr and ggplot2

If you haven’t seen it yet, there’s a great example of why it’s always important to visualize your data making its way around the Twitter-verse. A great demonstration of why we need to plot the data and never trust statistics tables! https://t.co/JyUb57v0or pic.twitter.com/hsivGZdpZ1 — Taha Yasseri (@TahaYasseri) May 1, 2017 Despite looking very different, all of these datasets have the same summary statistics to two decimal places. You can download the datasets, get details about the project, and read the whole paper by Justin Matejka and George Fitzmaurice here.

## Previewing the 2017 Men's NCAA Basketball Tournament

March Madness officially tips off tomorrow with the First Four games in Dayton before the round of 64 begins on Thursday. In this post, we’ll look at each team’s chance of advancing and winning the national title. We’ll also look at who was help and hurt most by how the committee seeded the tournament. As always, the code and data for this post are available on my Github page.

## Predicting the Winner of the 2017 Big 12/SEC Challenge

The Big 12/SEC challenge tips off tomorrow. This will be the 4th year of this competition, and the Big 12 has never lost. In this post, we’ll use a Monte Carlo simulation to estimate the Big 12’s chances of continuing this streak for another year. As always, the code and data for this post are available on my Github page. The Ratings The team ratings come from my sports analytics website, Hawklytics.

## Making Win Probability Plots with ggplot2

Last week I premiered my in game win probabilities for KU basketball. These have been available for a while on Hawklytics, but were always made after the game rather than in real time. Now that they are going live, I thought it would helpful to document how these are made using R and the ggplot2 package. Calculating Win Probability The win probabilities are based on the Elo ratings that I calculate for the team ratings on Hawkytics.