Write a brief introduction about the data being plotted, including the information
The data we are examining here is the ancestry of participants in genome wide assiociation studies. A study conducted in 2009 indicated that 96% of all GWAS studies were of European descent,clearly underrepresenting Asian, African, and Native Peoples ancestry. Having the majority of participants coming from European descent can often mislead data in the genomic field. By making our data include other heritages our data becomes more representative. This explains why there was a follow-up study in 2016 trying to see if the data had changed at all, they collected the data by analyzing the sample descriptions in the GWAS catalog where there was a decent amount of heterogeneity listed allowing Popejoy and Fullerton to reanalyze the data.
Create vectors to contain the data and labels to make the pie graphs at the top of figures.
Each vector has 3 elements: European ancestry, Asian ancestry, and other non-European ancestry.
DO NOT name your vector for the labels “labels”, since this is the name of an existing R function.
Include new line characters in the text as needed to improve spacing.
x<-c(.96,.03,.01)
xx<-c(81,14,5)
# set up par()
par(mfrow = c(1,2), mar = c(2,6,3,7))
#pie graphs 1
# add main, init.angle, radius, and col
pie(x, labels = c("European Ancestry", "Asian Ancestry", "Other non-European Ancestry"), main = "2009 Graph", init.angle = -86, radius = .75,col = c(8,9,0) )
# pie graph 2
# add main, init.angle, radius, and col
pie(xx,labels = c("European Ancestry", "Asian Ancestry", "Other non-European Ancestry"),main = "2016 Graph", init.angle = -34,radius = .75,col = c(5,2,3))
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)