This is information gathered from the sample descriptions from 35 million GWAS samples. This data was collected by researchers at the University of Pennsylvania. The same processes were done in 2009 as well as 2016 to track the changesin demographics represented by GWAS studies.
This is the data being plotted in the pie graphs. New line characters were added to the labels so that they will be properly formatted.
graph_labels <- c("European\n ancestry", "\n\n\nAsian\n ancestry", "other\n non-European\n ancestry")
graph_data_2009 <- c(96, 3, 1)
graph_data_2016 <- c(81, 14, 5)
These are the pie graphs generated by the data above. I used the init.angle argument to rotate the graphs and used the col argument to set the colors of the slices of the pie graphs so that they would match those from the artile.
# set up par()
par(mfrow = c(1,2), mar = c(2,3,1,5))
#pie graphs 1
# add main, init.angle, radius, and col
graph_labels <- c("European\n ancestry\n\n\n", "\n\nAsian\n ancestry", "\n\n\nother\n non-European\n ancestry")
colors <- c("#330033", "#00FFFF", "#33CCCC")
pie(graph_data_2009, graph_labels, main = "2009", init.angle = -82, col=colors)
# pie graph 2
# add main, init.angle, radius, and col
pie(graph_data_2016, graph_labels, main = "2016", init.angle = -55, col=colors)
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)