Hi list, Does any body know how I can create a margin area around the graphic created by xyplot (the same thing we do using par in plot function)? I tried viewport, but does not work.
Here is the code: ============================================== require(grid) vp<- viewport(x=.1,y=.1,width=.6,height=.6,just=c("left", "bottom")) pushViewport(vp) plotDATA=data.frame(Loss=c(1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10),Level=c("AvgAll","AvgAll","AvgAll","AvgAll","AvgAll","AvgAll","AvgAll", "AvgAll","AvgAll","AvgAll","AvgAll","AvgAll","GUL","GUL","GUL","GUL","GUL","GUL","GUL","GUL"),Line=c(1,2,3,4,5,6,7,8,9,10,11,12,1,2,3,4,5,6,7,8)) library(lattice) xyplot( Loss ~ Line, data=plotDATA, t="p",scales=list(relation="sliced",x=list(at = 1:12),y=list(at = 0:10,axs="i")), panel=function(x,y,subscripts, groups,...){ panel.xyplot(subset(plotDATA, Level=="AvgAll")$Line,subset(plotDATA, Level=="AvgAll")$Loss ,col="black",lwd=3,origin=0,...) panel.axis(side = "right", at=c(4,8),labels=c(200,400),outside=TRUE,ticks=TRUE,half=FALSE) panel.barchart(subset(plotDATA,Level=="GUL" )$Line, subset(plotDATA,Level=="GUL" )$Loss,box.ratio=1,horizontal = FALSE,stack = TRUE,reference = TRUE,col="blue",border="blue") } ) ================================================ Thanks and regards, Alireza [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org 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.