# graphics for proteomics # 15 April 2013 # NJG par.default <- par(no.readonly=TRUE) ################################################ # Figure 1. standard pie chart # data from Petricka et al. 2012 Fig 1D Arab.labels <- c("Root Hairs", "Epidermis","Cortex", "Endodermis","Vasculature", "Columella") Protein.per <- c(34,8,9,8,29,12) pie(Protein.per, labels=Arab.labels,main="Pie Chart", sub="Figure 1. A typical pie chart, which makes it hard to estimate proportions from the angles and does not preserve the original form of the data. Proportion data are taken from Petricka et al. (2012) Figure 1D.") ############################################### # Figure 2. replotted as a bar chart library(RColorBrewer) Brew.cols <- brewer.pal(6,"Pastel1") par(fig=c(0,1,0.3,1)) barplot(Protein.per,names.arg=Arab.labels,ylim=c(0,40),col=Brew.cols, ylab="% of Proteins",xlab="Cell Types", main = "Bar Plot") mtext("Figure 2. A standard bar plot makes it easier to estimate the proportions, but is not practical for a large number of categories.", side= 1,line=10) grid(nx=0,ny=8,col="gray") par(par.default) ################################################################## # Figure 3. improved with a fan chart with RColorBrewer palette library(plotrix) library(RColorBrewer) Brew.cols <- brewer.pal(6,"Pastel1") par(fig=c(0,1,0.3,1)) fan.plot(Protein.per, labels = Arab.labels, col=Brew.cols, main="Fan Plot") par(new=TRUE) par(fig=c(0,1,0.3,1)) plot(Protein.per,type="n",font.sub=1,axes=FALSE, ann=FALSE) mtext("Figure 3. A fan plot is an improvement over a pie chart because proportions can be estimated more accurately from the length of the arcs.", side= 1,line=6) par(par.default) ######################################################## #Figure 4. dotchart for long lists of elements par(mar=c(9,4,4,2)) Protein.list = paste("Protein",1:50," ") Express1 <- sort(runif(20,1,6)) Express2 <- sort(runif(20,3,12)) Express3 <- sort(runif(10,9,12)) Proteins <- c(Express1,Express2,Express3) Grps <- factor(c(rep("Metabolic",20),rep("Chaperone",20),rep("Heat Shock",10))) dotchart(Proteins,labels=Protein.list,,groups=Grps,xlab="Fold Induction", gcolor="red",pch=21,bg="gold",lcol="blue",cex=0.6, main="Dot Chart") mtext("Figure 4. A dotchart efficiently displays quantitative values with labels and sorted groups",side=1,line=7) par(par.default) ################################################## # Figure 5. plot showing polar coordinates library(plotrix) par(fig=c(0,1,0.2,1)) polar.plot(lengths=0,polar.pos=seq(135,240,length=6), main="Polar Plot",lwd=10,line.col=NA, radial.lim=c(0,40),start=0,rp.type="r", labels="", show.grid.labels=3,mar=c(2,4,7,2)) mtext("Figure 5. In a polar plot, each point is located within a circle. The first coordinate is the angle (0-360), and the second coordinate is the continuous variable (in this case, a scale from 0-40 units).", side= 1,line=6) par(par.default) ######################################## # Figure 6. Simple plot of protein numbers library(plotrix) par(fig=c(0,1,0.2,1)) polar.plot(lengths=Protein.per,polar.pos=seq(135,240,length=6), main="Polar Plot of Vectors",lwd=10,line.col=NA, radial.lim=c(0,40),start=0,rp.type="r", labels=Arab.labels,label.pos=seq(135,240,length=6), show.grid.labels=3,mar=c(2,4,7,2)) polar.plot(lengths=Protein.per,polar.pos=seq(135,240,length=6), add=TRUE, main="",lwd=10,line.col="seagreen", radial.lim=c(0,40),start=0,rp.type="r", labels=Arab.labels,label.pos=seq(135,240,length=6), show.grid.labels=3,mar=c(2,4,7,2),show.grid=FALSE, show.radial.grid=FALSE) mtext("Figure 6. Protein numbers illustrated in a polar plot. The relative proportions can be easily compared, but the original units (numbers of proteins) are preserved.", side= 1,line=6) par(par.default) ############################################################# # Figure 7. Now add a second set and color code for a new treatment par(fig=c(0,1,0.2,1)) Protein2.per <- c(9,20,30,21,11,9) polar.plot(lengths=c(Protein.per,Protein2.per), polar.pos=rep(seq(140,220,length=6),2)+rep(c(0,180),each=6), lwd=10,line.col=rep(c("seagreen","goldenrod"),each=6), radial.lim=c(0,40),start=0,rp.type="r", labels=Arab.labels, label.pos=rep(seq(140,220,length=6),2)+rep(c(0,180),each=6), show.grid.labels=3,mar=c(2,4,7,4),cex=2) mtext("Control",side=2,font=2,las=1,cex=1.5,line=3,at=30) mtext("Ectopic",side=4,font=2,las=1,cex=1.5,line=3,at=30) mtext("Polar Plot\nWith Two Groups",side=3,font=2,las=1,cex=1.75,line=1, at=0) mtext("Figure 7. Comparison of two groups in a polar plot. With exactly 2 groups, the vectors can be extended and color coded to illustrate comparisons within and between groups.", side= 1,line=6) par(par.default) ##################################################### # Figure 8. Create a graph for 100 proteins, with 4 proteins coded par(fig=c(0,1,0.2,1)) Protein.col <- rep("black",100) Protein.col[c(60, 70, 93,95)] <- "red" Protein.express <- sort(rgamma(100,shape=1,scale=3)) polar.plot(lengths=Protein.express, polar.pos=seq(10,350,length=100), lwd=2,line.col=Protein.col, radial.lim=c(0,max(Protein.express)),start=0,rp.type="r", show.grid.labels=4,mar=c(2,4,7,4),cex=2) mtext("Polar Plot\nOf 100 ER Proteins",side=3,font=2,las=1,cex=1.75,line=2, at=0) par(par.default) mtext("Figure 8. Peptide composition of individual proteins. Each line represents the expression of an individual protein. The proteins are ordered by expression intensity, with 4 particular proteins (#60,70,93,95) highlighted.", side= 1,line=2) par(par.default) ############################################################# # Figure 9. Create a graph for 100 proteins, with special coding for peptide number par(fig=c(0,1,0.2,1)) library(RColorBrewer) my.reds <- brewer.pal(6,"Reds") red6 <- sample(my.reds,100,replace=TRUE,prob=6:1) Protein.express <- sort(rgamma(100,shape=1,scale=3)) Protein.express <- runif(100,0,12) polar.plot(lengths=Protein.express, polar.pos=seq(10,350,length=100), lwd=3,line.col=red6, radial.lim=c(0,max(Protein.express)),start=0,rp.type="r", labels="", show.grid.labels=4,mar=c(2,4,7,4),cex=2) mtext("Normalized Fold Induction\nOf 100 ER Proteins",side=3,font=2,las=1,cex=1.75,line=1, at=0) legend(-15,15,pt.cex=1.2,legend=c("1 peptide","2 peptides","3 peptides", "4 peptides", "5-10 peptides","> 10 peptides"), fill=my.reds) mtext("Figure 9. Peptide composition of individual proteins. Each line represents the expression of an individual protein. The ordering is arbitrary, but colors show number of peptides used in the protein identification.", side= 1,line=4) par(par.default) #################################################### # Figure 10. mosaic plot for two categorical variables library(RColorBrewer) my.blues <- brewer.pal(4,"Blues") Protein.counts <- matrix(c(100,25,300,40,60,4,200,22,48,20,99,777),nrow=3, dimnames=list(c("Control","Enriched","Disturbed"),c("1 peptide","2 peptides", "3 peptides", "> 3 peptides"))) mosaicplot(t(Protein.counts),col=my.blues,main="Mosaic Plot Of Protein Counts") mtext("Figure 10. Protein composition as a function of experimental treatment. Heights are proportional to protein numbers in each treatment, and widths are proportional to the number of peptides in each protein. Tile areas are proportional to the number of proteins in each grouping.", side= 1,line=4) par(par.default)