The data being plotted here comes from the paper “Genomics is failing on diversity” by Popejoy and Fullerton (https://www.nature.com/articles/538161a). The data was taken from catalogued genome-wide association studies (GWAS). They were looking at the ancestry of participants and determining the percentages of each background. It was repeated in 2016 to determine how the study diversity has changed in recent years. Although it had increased in diversity, genomics still has a long way to go.
First the data needs to be made that we want to graph. First making the labels we will be using by creating a vector contianing them. This is followed by making two vectors with the precentages from the paper for each year, keeping the same order as the label vector. You can also include new line characters in the label vector to improve spacing.
ancestry <- c("European\n", "\nAsian", "\nOther non-European")
data.2009 <- c(96, 3, 1)
data.2016 <- c(81, 14, 5)
You can then recreate these pie charts with the following steps:
# set up par()
par(mfrow = c(1,2), mar = c(2,3,1,5))
#pie graphs 1
pie(data.2009, labels = ancestry, main = "Diversity in 2009", init.angle = -82, radius = 1, col = c(1,5,8))
# pie graph 2
pie(data.2016, labels = ancestry, main = "Diversity in 2016", init.angle = -58, radius = 1, col = c(1,5,8))