Introduction

In 2009, Alice B. Popejoy and Stephanie M. Fullerton collected data that revealed a lack of diversity in genome-wide association studies (GWAS). To collect the data, they analyzed the sample descriptions included in the GWAS catalog. This process was also repeated in 2016 after a significant increase in the number of studies involving GWAS. Their findings from both of these years are included in the pie charts.

Create data

Create vectors to contain the data and labels to make the pie graphs at the top of figures.

data2009 <- c(96, 3, 1)
data2016 <- c(81, 14, 5)
ancestrylabels <- c("European\n ", "\nAsian", "\n \nOther\n Non-European")

Pie graphs

Create two different pie graphs, one for the 2009 data and one for the 2016 data.

# set up par()
par(mfrow = c(1,2), mar = c(2,3,1,5))

#pie graph 1
# add main, init.angle, radius, and col
pie(data2009, labels = ancestrylabels, main = "2009", init.angle = -82, radius = 1, col = c(2,3,4))

# pie graph 2
# add main, init.angle, radius, and col
pie(data2016, labels = ancestrylabels, main = "2016", init.angle = -50, radius = 1, col = c(2,3,4)) 

Bar graphs

If you want, you can examine this code below to see how stracked bar graphs are made

# data
dat2016 <- c(14, 3,1,0.54,0.28,0.08,0.05)
dat2016_rev <- rev(dat2016)
barplotdata2016 <- matrix(c(dat2016_rev))

# labels
labels_x <- rev(c("Asian","African","Mixed", "Hispanic &\nLatin American",
                        "Pacific Islander","Arab & Middle East","Native peoples"))

par(mfrow = c(1,1))

barplot(barplotdata2016,
        width = 0.01, 
        xlim = c(0,0.1),
         axes = F,
        col = c(1,2,3,4,5,6,7),
        legend.text = labels_x)