Mike Livermore CSI 773 Week 2 Assignment September 2010

3a2 #5:

3a2 #6:

 

windows(width=7,height=9)

# Graphic parameters

cex = 1.2 # character expansion size

 

testLayout <- panelLayout(nrow=4,ncol=2,

rowSep=0, # values are replicate

colSep=0, # values are replicate

leftMar=.5,right=.5,bottom=.5)

 

panelSelect(testLayout,margin='top')

panelScale() # default rx=c(0,1), ry=c(0,1)

panelFill("lightBlue")

text(.5,.5,'Top Margin',adj=.5,cex=2)

 

panelSelect(testLayout,margin='bottom')

panelScale()

panelFill("lightBlue")

text(.5,.5,'Bottom Margin',adj=.5,cex=cex)

 

 

panelSelect(testLayout,margin='left')

panelScale()

panelFill("lightBlue")

text(.5,.5,'Left Margin',adj=.5,srt=90,cex=cex)

 

panelSelect(testLayout,margin='right')

panelScale()

panelFill("lightBlue")

text(.5,.5,'Right Margin',adj=.5,srt=90,cex=cex)

panelOutline()

 

# Now outlines the other margin panels

 

panelSelect(testLayout,margin='top')

panelScale()

panelOutline()

 

panelSelect(testLayout,margin='bottom')

panelScale()

panelOutline()

 

panelSelect(testLayout,margin='left')

panelScale()

panelOutline()

 

# Now fill label and outline the data panels

 

mycolors=c('#FF0000','#FF0000','#0088FF','#FFFF00')

for(i in 1:4){

for (j in 1:2){

panelSelect(testLayout,i,j)

panelScale()

panelFill(col=mycolors[i])

if (i>2) panelOutline()

if (i==2) panelOutline(col="red")

if (i>1) {

text(.5,ifelse(i==2,.9,.5),paste("Row",i-1,' Col',j,sep=' '),adj=.5,cex=cex,

font=ifelse(j==1,1,2),

col=ifelse(i==1,"white","black"))

}

}}