Copying the plot – 1

Hello, today i’m going to try something different, it’s not going to be original content. I am going to be having a go at copying a data visualisation. The data visualisation comes from latest tidy Tuesday data set and is taken from the Economist. See the plot below:

The key parts of this plot:

  • Faceted by category of the award a plot of the age of the winner against the year it was awarded all different colours with the points slightly faded
  • All have separate lines of best fit
  • The y axis for all graphs is on the right hand side
  • The oldest and youngest winners are highlighted
  • X axis is has only every 50 years labelled
  • The background is grey with white lines every 25

So first things first lets get the faceted plot:

So the first issue is the categories are in the wrong order and and the colours are the ggplot standard colours. Lets adjust the colours and the plot order

The colours are now right lets look at changing the axis labels and the background colours

Getting there though the y axis isn’t quite right the labels in the original are 25, 50, 75 and 100. Also too many grid lines. Next ill alter that and the title for each panel as they are coloured the same as the plot.

As you will see from the code I had to do something a bit hacky in order to get the labels the same colour. I did it by creating a separate data frame with the labels on [dat_text1] and then used that on the plot object as a geom_text object in order to get the colours. I’m surprised theirs not a simpler way to do it as that was a lot of googling. Now lets title the plot as the original one

The plot is now labelled as the original. The final part is to label the oldest and youngest winners.

There’s the final plot. I think its a pretty accurate reflection. One thing i’m not so sure about is how the key was done. I think that was added post the generation of the graph as an extra graphic as to me that seems impossible in ggplot. Thanks for reading hope you enjoyed. Full code below


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s