This is a comparison of 2009 and 2016 data for different groups that participate in Genome Wide Association Studies. Alice B. Popejoy and Stephanie M. Fullerton analyzed sample descriptionsin GWAS catalogs in 2009, and repeated this in 2016 to serve as a comparison. In 2009, most participants were of European descent. In 2016, there were more Asian participants, but this is largely due to genomic studies being done in Asian countries.
euro_non_euro1<- c(96, 3, 1)
euro_non_euro1_labels<- c("European", "Asian", "\nOther")
euro_non_euro2.2<- c(84, 14, 5)
# set up par()
par(mfrow = c(1,2), mar = c(2,3,1,5))
#pie graphs 1
# add main, init.angle, radius, and col
pie(x=euro_non_euro1, labels = euro_non_euro1_labels, radius= 1, init.angle = -82, col= c(1,2,3), main= "2009")
# pie graph 2
# add main, init.angle, radius, and col
pie(x= euro_non_euro2.2, labels= euro_non_euro1_labels, radius=1, init.angle= -82, col= c(1, 2, 3), main= "2016")
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)