Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. legend(4, 20, c("Placebo", "Progabide"), lty=1:2, pch=c(1,16), col=1:2, cex=0.8)
  2.  
  3. plot(x=1:10,y=1:10+rnorm(10), ylim=c(0,11))
  4.  
  5. # draw default box and store size of default rect in 'a'
  6. # disable this default rect by adding plot=F to legend()
  7. a=legend(x=1,y=9, c("old box", "new box"), lty=1, col=2:1, cex=0.8, y.intersp=0.8,box.col=2)#,plot=F)
  8.  
  9. # box size reduced by factor 0.75
  10. a=a$rect
  11. mid = a$top - 0.5*a$h
  12. reduction = 0.75
  13.  
  14. # draw new box
  15. rect(xleft=a$left, ytop=mid+0.5*reduction*a$h, xright=a$left+a$w, ybottom=mid-0.5*reduction*a$h)
  16. # add legend items to new box
  17. legend(x=1,y=9, c("old box", "new box"), lty=1, col=2:1, cex=0.8, y.intersp=0.8, bty='n')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement