Skip to main content

Posts

Showing posts from March, 2018

[How-To] How to a add custom table to a ggplot chart

For one of my recent posts I needed to add a customized and dynamic table to a ggplot chart. This can often be helpful to display information in addition to the main idea you are presenting in the plot. In my example I wanted to show free kick conversion rates by season in a table format. I found this to be far from straightforward so I will try to outlay the main concepts here in case anybody has the same problem. To make this as engaging as possible I will use an example based on the diamonds data set which comes with the usual R installation. This data set has information on the size, cut, color, prize and some other characteristics of diamonds. You can follow the steps below by copying the code into your RStudio or R environment. library (ggplot2) head (diamonds) ## # A tibble: 6 x 10 ## carat cut color clarity depth table price x y z ## <dbl> <ord> <ord> <ord> <dbl> <dbl> <int> <dbl>

Lionel Messi's free kick stats

I got a lot of feedback of people wanting to compare Cristiano Ronaldo's free kick stats with those of Lionel Messi. See them below in direct comparison: Lionel Messi Cristiano Ronaldo