[R] Problems with making a complex graphic

From: Kjetil Halvorsen <kjetilbrinchmannhalvorsen_at_gmail.com>
Date: Fri 22 Sep 2006 - 04:49:28 EST


Hola!

maybe someone can see what is wrong in the following graphics code. The data needed for the example (printed with dump) is at the end of the message.
I make 3 pages with multipanel plot, and want each page to have a subtitle explaining the common x-axis, with the command: title(sub="aleles(bp)", outer=TRUE,adj=0.5,col="snow3") but nothing appears. What is wrong?

Here is the code:

par(ask=TRUE)

par(mfcol=c(6,2),mar=c(2,2,3,0)+0.1 ,bg="gray3", col.axis="snow3", col.lab="snow3",
col.main="snow3", col.sub="snow3",

        oma=c(4,3,4,0), cex.axis=0.6, cex.main=0.8, cex.sub=0.6, cex.lab=0.6, yaxt="n")

for (i in 1:6) {

   barplot( tab107[,i], names.arg=c(182, 196, 200, 202, 206, 210, 220, 248) ,

               col="snow3" , main=pops[i] ,xlab="", ylab="" ) }

for (i in 1:6) {

   barplot(tab02[,i], names.arg=c(140, 148, 152, 172, 178, 180, 196, 198, 206, 210, 230),

               col="snow3", main=pops[i] , xlab="", ylab="")}

title(main=paste(alelos[1],"
",alelos[2]), outer=TRUE, cex=1.5, col="red")

   title(sub="aleles(bp)", outer=TRUE,adj=0.5,col="snow3")    mtext(side=2,text="Frecuencias", outer=TRUE,adj=0.5)

par(mfcol=c(6,2),mar=c(2,2,3,0)+0.1 ,bg="gray3", col.axis="snow3", col.lab="snow3",
col.main="snow3", col.sub="snow3",

        oma=c(4,3,4,0), cex.axis=0.6, cex.main=0.8, cex.sub=0.6, cex.lab=0.6,yaxt="n")

for (i in 1:6) {

   barplot( tab137[,i], names.arg=c(128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 164, 180),

                col="snow3", main=pops[i] ,xlab="", ylab="")}


for (i in 1:6) {

   barplot( tab110[,i], names.arg=c(158, 162, 164, 168, 172, 176, 180, 198) ,

                col="snow3", main=pops[i], xlab="",ylab="") }


title(main=paste(alelos[3],"
",alelos[4]), outer=TRUE,cex=1.5, col="red")

   title(sub="aleles(bp)", outer=TRUE, adj=0.5, col="snow3")    mtext(side=2,text="Frecuencias", outer=TRUE,adj=0.5)

par(mfcol=c(6,2),mar=c(2,2,3,0)+0.1 ,bg="gray3", col.axis="snow3", col.lab="snow3",
col.main="snow3", col.sub="snow3",

        oma=c(4,3,4,0), cex.axis=0.6, cex.main=0.8, cex.sub=0.6,cex.lab=0.6, yaxt="n")

for (i in 1:6) {

   barplot( tab28[,i], names.arg=c(120, 124, 128, 130, 132, 134) ,

                col="snow3", main=pops[i], xlab="", ylab="") }


title(main=paste(alelos[5],"
"), outer=TRUE,cex=1.5, col='red')

   title(sub="aleles(bp)", outer=TRUE,adj=0.5, col="snow3")    mtext(side=2,text="Frecuencias", outer=TRUE,adj=0.5)

Here is the sessionInfo:

R version 2.4.0 alpha (2006-09-16 r39365) i386-pc-mingw32

locale:
LC_COLLATE=Spanish_Bolivia.1252;LC_CTYPE=Spanish_Bolivia.1252;LC_MONETARY=Spanish_Bolivia.1252;LC_NUMERIC=C;LC_TIME=Spanish_Bolivia.1252

attached base packages:
[1] "methods" "stats" "graphics" "grDevices" "utils" "datasets" [7] "base"

Here is the necessary data:

alelos <-
c("ADC107", "ADC02", "ADC137", "ADC110", "ADC28") pops <-
c("Prado", "P. Rico", "Guayaramerin", "C. Esperanza", "R. de Yata",
"S. Miguel")

tab02 <-
structure(list(V3 = c(0.012, 0.183, 0, 0.195, 0.012, 0.049, 0.012,

0.305, 0.232, 0, 0), V4 = c(0.024, 0.476, 0, 0.012, 0, 0.073,
0.024, 0.171, 0.171, 0.049, 0), V5 = c(0.014, 0.111, 0.014, 0.236,
0.111, 0.194, 0, 0.042, 0.236, 0.028, 0.014), V6 = c(0.024, 0.214,
0, 0.202, 0.024, 0.167, 0.06, 0.071, 0.202, 0.036, 0), V7 = c(0.038,
0.449, 0, 0.128, 0.077, 0.038, 0, 0, 0.192, 0.077, 0), V8 = c(0, 0.338, 0, 0.113, 0.125, 0.138, 0, 0.038, 0.125, 0.075, 0.05)), .Names = c("V3",
"V4", "V5", "V6", "V7", "V8"), row.names = c("1", "2", "3", "4",
"5", "6", "7", "8", "9", "10", "11"), class = "data.frame")
tab107 <-
structure(list(V3 = c(0.079, 0.421, 0.118, 0.158, 0.079, 0.079, 0.066, 0), V4 = c(0.053, 0.5, 0.066, 0.118, 0.211, 0.039, 0.013, 0), V5 = c(0.222, 0.444, 0.069, 0.181, 0.042, 0.014, 0.028, 0 ), V6 = c(0.138, 0.625, 0.113, 0.1, 0.013, 0.013, 0, 0), V7 = c(0.135, 0.541, 0.041, 0.095, 0.149, 0.014, 0.014, 0.014), V8 = c(0.212, 0.53, 0.061, 0.076, 0.03, 0.03, 0.03, 0.03)), .Names = c("V3",
"V4", "V5", "V6", "V7", "V8"), row.names = c("1", "2", "3", "4",
"5", "6", "7", "8"), class = "data.frame")
tab110 <-
structure(list(V3 = c(0.088, 0.25, 0.338, 0.213, 0.038, 0, 0.075, 0), V4 = c(0.107, 0.393, 0.333, 0.095, 0.024, 0, 0.048, 0), V5 = c(0.162,
0.351, 0.27, 0.149, 0.014, 0.014, 0.041, 0), V6 = c(0.012, 0.14,
0.535, 0.186, 0.07, 0, 0.058, 0), V7 = c(0.027, 0.23, 0.392,
0.149, 0.095, 0, 0.081, 0.027), V8 = c(0, 0.125, 0.475, 0.263,
0.088, 0, 0.025, 0.025)), .Names = c("V3", "V4", "V5", "V6",

"V7", "V8"), row.names = c("1", "2", "3", "4", "5", "6", "7",
"8"), class = "data.frame")
tab137 <-
structure(list(V3 = c(0.111, 0.069, 0.097, 0.167, 0.014, 0.069,
0.278, 0.153, 0.028, 0, 0.014, 0, 0, 0), V4 = c(0.05, 0.063,
0.038, 0.213, 0, 0.075, 0.3, 0.125, 0.1, 0, 0.013, 0, 0.013,
0.013), V5 = c(0.103, 0.167, 0.064, 0.115, 0, 0.064, 0.333, 0.064,
0.026, 0.013, 0.051, 0, 0, 0), V6 = c(0, 0.026, 0.079, 0.171,
0.026, 0.118, 0.289, 0.158, 0.053, 0.013, 0.039, 0.026, 0, 0),

    V7 = c(0, 0.063, 0.075, 0.2, 0.1, 0.125, 0.225, 0.163, 0.038,     0, 0, 0.013, 0, 0), V8 = c(0, 0.075, 0.038, 0.113, 0.063,     0.188, 0.188, 0.238, 0.075, 0, 0.025, 0, 0, 0)), .Names = c("V3",
"V4", "V5", "V6", "V7", "V8"), row.names = c("1", "2", "3", "4",
"5", "6", "7", "8", "9", "10", "11", "12", "13", "14"), class = "data.frame
")
tab28 <-
structure(list(V3 = c(0, 0.167, 0.444, 0.097, 0.097, 0.194),

    V4 = c(0, 0.125, 0.4, 0.238, 0.088, 0.15), V5 = c(0.013,

    0.064, 0.487, 0.231, 0.051, 0.154), V6 = c(0, 0.122, 0.537,
    0.122, 0.061, 0.159), V7 = c(0, 0.09, 0.577, 0.141, 0.026,
    0.167), V8 = c(0, 0.158, 0.579, 0.171, 0.013, 0.079)), .Names = c("V3",

"V4", "V5", "V6", "V7", "V8"), row.names = c("1", "2", "3", "4",
"5", "6"), class = "data.frame")

Thanks,Kjetil Halvorsen

        [[alternative HTML version deleted]]



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Fri Sep 22 05:14:13 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 22 Sep 2006 - 06:03:11 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.