R绘图系统7

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

7.1grid.rect(gp=gpar(col=gray))grid.circle(name=circles,x=seq(0.1,0.9,length=40),y=0.5+0.4*sin(seq(0,2*pi,length=40)),r=abs(0.1*cos(seq(0,2*pi,length=40))))grid.edit(circles,gp=gpar(col=gray(c(1:20*0.04,20:1*0.04))))grid.remove(circles)7.2grid.rect(gp=gpar(col=gray))suffix-c(even,odd)for(iin1:8)grid.circle(name=paste(circle.,suffix[i%%2+1],sep=),r=(9-i)/20,gp=gpar(col=NA,fill=gray(i/10)))grid.edit(circle.odd,gp=gpar(fill=gray10),global=TRUE)grid.edit(circle,gp=gpar(col=gray,fill=gray90),grep=TRUE,global=TRUE)7.3labels-c(\xaxis1\\nxaxisgTree,\major\\nlinesgrob,\ticks\\nlinesgrob,\labels\\ntextgrob)names-c(,major,ticks,labels)boxheight-unit(2.5,line)boxwidth-unit(1.2,in)pushViewport(viewport(layout=grid.layout(2,3)))pushViewport(viewport(layout.pos.row=1,layout.pos.col=2))grid.text(labels[1])grid.lines(unit(0.5,npc)+unit.c(-0.5*boxwidth,0.5*boxwidth),0.5,gp=gpar(col=gray))grid.roundrect(height=boxheight,width=boxwidth,#1.2*stringWidth(labels[1]),r=unit(2,mm),gp=gpar(fill=NA))popViewport()pushViewport(viewport(layout.pos.row=2,layout.pos.col=1))grid.text(labels[2])grid.lines(unit(0.5,npc)+unit.c(-0.5*boxwidth,0.5*boxwidth),0.5,gp=gpar(col=gray))grid.roundrect(height=boxheight,width=boxwidth,#1.2*stringWidth(labels[2]),r=unit(2,mm),gp=gpar(fill=NA))popViewport()pushViewport(viewport(layout.pos.row=2,layout.pos.col=2))grid.text(labels[3])grid.lines(unit(0.5,npc)+unit.c(-0.5*boxwidth,0.5*boxwidth),0.5,gp=gpar(col=gray))grid.roundrect(height=boxheight,width=boxwidth,#1.2*stringWidth(labels[3]),r=unit(2,mm),gp=gpar(fill=NA))popViewport()pushViewport(viewport(layout.pos.row=2,layout.pos.col=3))grid.text(labels[4])grid.lines(unit(0.5,npc)+unit.c(-0.5*boxwidth,0.5*boxwidth),0.5,gp=gpar(col=gray))grid.roundrect(height=boxheight,width=boxwidth,#1.2*stringWidth(labels[4]),r=unit(2,mm),gp=gpar(fill=NA))popViewport()pushViewport(viewport(layout.pos.row=1,layout.pos.col=2))grid.move.to(x=0.5,y=unit(0.5,npc)-0.5*boxheight)popViewport()pushViewport(viewport(layout.pos.row=2,layout.pos.col=1))grid.line.to(x=0.5,y=unit(0.5,npc)+0.5*boxheight,arrow=arrow(angle=10,length=unit(3,mm)))popViewport()pushViewport(viewport(layout.pos.row=1,layout.pos.col=2))grid.move.to(x=0.5,y=unit(0.5,npc)-0.5*boxheight)popViewport()pushViewport(viewport(layout.pos.row=2,layout.pos.col=2))grid.line.to(x=0.5,y=unit(0.5,npc)+0.5*boxheight,arrow=arrow(angle=10,length=unit(3,mm)))popViewport()pushViewport(viewport(layout.pos.row=1,layout.pos.col=2))grid.move.to(x=0.5,y=unit(0.5,npc)-0.5*boxheight)popViewport()pushViewport(viewport(layout.pos.row=2,layout.pos.col=3))grid.line.to(x=0.5,y=unit(0.5,npc)+0.5*boxheight,arrow=arrow(angle=10,length=unit(3,mm)))popViewport()7.4grid.rect(gp=gpar(col=gray))pushViewport(viewport(just=bottom,gp=gpar(cex=0.7)))grid.xaxis(name=axis1,at=1:4/5)grid.ls()grid.edit(axis1,at=1:3/4)grid.edit(gPath(axis1,labels),rot=45)popViewport()7.5tg-textGrob(sampletext)rg-rectGrob(width=1.1*grobWidth(tg),height=1.3*grobHeight(tg))boxedText-gTree(children=gList(tg,rg))pushViewport(viewport(layout=grid.layout(1,7,heights=unit(1.25,in),widths=unit(rep(c(1,1.25),length=7),rep(c(null,in),length=7)))))pushViewport(viewport(layout.pos.col=2,gp=gpar(fill=NA)))grid.rect(gp=gpar(col=gray,fill=NA))grid.draw(boxedText)popViewport()pushViewport(viewport(layout.pos.col=4,gp=gpar(fill=NA)))grid.rect(gp=gpar(col=gray,fill=NA))grid.draw(editGrob(boxedText,gp=gpar(col=gray)))popViewport()pushViewport(viewport(layout.pos.col=6,gp=gpar(fill=NA)))grid.rect(gp=gpar(col=gray,fill=NA))grid.draw(editGrob(boxedText,vp=viewport(angle=45),gp=gpar(fontsize=18)))popViewport()popViewport()7.6label-textGrob(A\nPlot\nLabel,x=0,just=left)x-seq(0.1,0.9,length=50)y-runif(50,0.1,0.9)gplot-gTree(children=gList(rectGrob(gp=gpar(col=gray60,fill=white)),linesGrob(x,y),pointsGrob(x,y,pch=16,size=unit(1.5,mm))),vp=viewport(width=unit(1,npc)-unit(5,mm),height=unit(1,npc)-unit(5,mm)))layout-grid.layout(1,2,widths=unit(c(1,1),c(null,grobwidth),list(NULL,label)))grid.rect(gp=gpar(col=gray60,fill=gray90))pushViewport(viewport(layout=layout))pushViewport(viewport(layout.pos.col=2))grid.draw(label)popViewport()pushViewport(viewport(layout.pos.col=1))grid.draw(gplot)popViewport(2)7.7tg1-textGrob(Sample)rg1-rectGrob(x=rep(0.5,2),width=1.1*grobWidth(tg1),height=1.3*grobHeight(tg1),gp=gpar(col=c(gray60,white),lwd=c(3,1)))pushViewport(viewport(layout=grid.layout(1,7,heights=unit(1.25,in),widths=unit(rep(c(1,1.25),length=7),rep(c(null,in),length=7)))))pushViewport(viewport(layout.pos.col=2,gp=gpar(fill=NA)))grid.rect(gp=gpar(col=gray,fill=NA))grid.draw(tg1)grid.draw(rg1)popViewport()pushViewport(viewport(layout.pos.col=4,gp=gpar(fill=NA)))grid.rect(gp=gpar(col=gray,fill=NA))pushViewport(viewport(gp=gpar(cex=2)))grid.draw(tg1)grid.draw(rg1)popViewport()popViewport()pushViewport(viewport(layout.pos.col=6,gp=gpar(fill=NA)))grid.rect(gp=gpar(col=gray,fill=NA))pushViewport(viewport(gp=gpar(cex=2)))grid.draw(tg1)popViewport()grid.draw(rg1)popViewport()popViewport()7.8tg1-textGrob(Sam

1 / 10
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功