Hi list,
In the following code, how can I place the percentage label away from
numbers in the second y-axis (lets say all should be inside plot area)?

Thanks
Alireza

=================
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="free", x=list(draw=TRUE, tick.number=12, labels=
1:12)),par.settings = list(clip = list(panel = "off")))
p<- xyplot( Loss ~ Line, data=plotDATA,
t="p",scales=list(relation="free",x=list(at = 1:12)),
    panel=function(x,y,subscripts, groups,...){
    panel.xyplot(subset(plotDATA, Level=="AvgAll")$Line,subset(plotDATA,
Level=="AvgAll")$Loss ,col=Lloydscolour(colIncP),lwd=3,origin=0,...)
    panel.axis(side = "right",
at=unique(plotDATA$Loss),labels=unique(plotDATA$Loss)/max(plotDATA$Loss)*100,outside=FALSE,ticks=TRUE,half=FALSE)
    panel.axis(side = "right",
at=median(plotDATA$Loss),labels="Percentage",outside=FALSE,ticks=FALSE,half=FALSE,rot=90)
    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")#,origin=0)
     }
 )

 print(p,position = c(0.1, 0.1, 0.9, .9))
=================

        [[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.

Reply via email to