makeSplot(sendplot)
makeSplot()所属R语言包:sendplot
Makes Static or Interactive Files
使静态或交互式文件
译者:生物统计家园网 机器人LoveR
描述----------Description----------
This function acts on an Splot object to make a static (png, jpeg, or postscript) image and if desired an interactive html.
此功能的作用上的Splot的对象,以静态图像(PNG,JPEG,或PostScript),如果需要的话,可交互的网页。
用法----------Usage----------
makeSplot(Splot,
fname.root="Splot",
dir="./",
overwriteSourcePlot = NA,
makeInteractive=TRUE,
overrideInteractive=NA,
Default=TRUE,
header="v3",
window.size = "800x1100",
returnObj = TRUE)
参数----------Arguments----------
参数:Splot
An Object of the class Splot
一个对象的类Splot
参数:fname.root
Base name to use for all file created
使用创建的所有文件的基本名称
参数:dir
directory path to where files should be created
应建立文件的目录路径
参数:overwriteSourcePlot
character or character vector, should static image generated be postscript, png, jpeg, or tiff. If this is NA, it uses what is specified in Splot object.
字符或字符向量,静态图像生成的后记中,PNG,JPEG或TIFF。如果这是NA,它使用中所指定Splot对象。
参数:makeInteractive
logical, should interactive html file be created. If FALSE, only static (ps, png, or jpeg) files is generated
逻辑,交互的HTML文件被创建。如果为FALSE,只有静态的(PS,PNG或JPEG)文件的生成
参数:overrideInteractive
logical of length equal to Splot\$nfig. Indicates which figures of the layout should be interactive; if NA uses what is specified in Splot object
逻辑的长度Splot \ $ nfig等于。表示数字应该是互动式的布局,如果NA使用中所指定的Splot对象
参数:Default
logical, If default tool-tip region is set should it be included in html
逻辑,如果默认情况下,刀尖区域设置,它被包含在HTML
参数:header
May either be v1,v2, or v3. This determines which tooltip header will be in the html file. Each version has different features or works well with different web browsers. see sp.header for details.
可能是V1,V2或V3。这决定了哪些工具提示头将在HTML文件中。每个版本都有不同的特点,或与不同的Web浏览器。有关详细信息,请参阅sp.header。
参数:window.size
size of the html window. Only effective when header=v3
html窗口的大小。只有有效的头= V3
参数:returnObj
Should Splot object be returned
如果Splot对象返回
Details
详细信息----------Details----------
users are encouraged to read vignette for more details and several examples.
鼓励用户阅读更多的细节和几个例子的小插曲。
值----------Value----------
Generates a static image (ps, png, or jpeg). If makeInteractive, an interactive .html file is generated If returnObj, Splot object is returned.
生成静态图像(PS,PNG或JPEG)。如果makeInteractive,互动生成的html文件,如果returnObj,Splot对象,则返回。
注意----------Note----------
The interactive html plot currently only works in web browsers that implement java script.
交互的HTML图目前只适用于在实现Java脚本的Web浏览器。
The code used to create the javascript embedded in html file is a modified version of the javascript code or from the open source tooltip library. see reference links
用于创建JavaScript嵌入在HTML文件中的代码是修改后的版本的JavaScript代码的开源工具提示库。见参考文献链接
(作者)----------Author(s)----------
Lori A. Shepherd, Daniel P. Gaile
参考文献----------References----------
参见----------See Also----------
sendplot, initSplot, makeImap, heatmap.send,
sendplot,initSplot,makeImap,heatmap.send,
实例----------Examples----------
#[]
# Please see vignette for full example[请看到小插曲完整的例子]
#[]
library(sendplot)
library("rtiff")
# set up layout matrix[设置布局矩阵]
mat = matrix(1,nrow=12, ncol=13)
mat[9:12,] = 2
mat[,9:13] = 3
mat[1:2,] = 4
# set margins[设置页边距]
mai.mat = matrix(.5,ncol=4,nrow=4)
# set matrix to be used in image call[设置矩阵被用于在图像呼叫]
myX = c(-1,-10,1,10,-5,0)
plot.calls = c(
"boxplot(count ~ spray, data = InsectSprays,col='lightgray')",
"plot(1:3,1:3,col='blue',xlab='',ylab=''); points(1:2,2:3,col='red')",
"image(1:2,1:3, z=matrix(myX,ncol=3,nrow=2), xlab='',ylab='')",
"plot(cos, xlim=c(-pi,3*pi), n=1001,col ='blue',xlab='',ylab='')"
)
plt.extras=list(
figure1="rect(xleft=c(3,1),
ytop=c(25,5),xright=c(4,2),ybottom=c(20,0));title(main='A', cex=3)",
figure2="polygon(x=c(2,2.5,3,2.5), y=c(1,2.5,1,1.5));title(main='B',
cex=3)",
figure3 ="title(main='C', cex=3)",
figure4="title(main='D', cex=3)"
)
#set up temporary directory[设立临时目录]
direct = paste(tempdir(),"/",sep="")
direct
#[]
#[]
# make Splot object[Splot对象]
#[]
#[]
# initialize Splot object [初始化Splot对象]
Splot = initSplot(mat, plot.calls, mai.mat=mai.mat,
plot.extras=plt.extras)
# first look/get plot output -- makes static image [先来看看/得到图输出 - 使静态图像]
Splot = makeSplot(Splot, fname.root="exToy", makeInteractive=FALSE,
dir=direct, returnObj=TRUE)
#[]
#[]
# Add regions for interactive toop-tip display [添加互动托普头显示区域]
#[]
#[]
# makes two rectangle regions interactive in figure 1[在图1中两个矩形区域互动]
Splot = makeImap(Splot, figure=1, xy.type="rect",
x.pos=c(3,1), y.pos=c(25,5),
x.right.pos=c(4,2), y.bottom.pos=c(20,0),
x.labels = as.data.frame(list(
label=c("rect1","rect2"),
info=c("im a link", "im a link"))),
asLinks = "http://www.buffalo.edu",
y.labels = c("d1",NA),
fname.root="exToy", dir=direct, spot.radius=10,
font.size=20, font.color="cyan", bg.color="black")
# makes one of the outlier points interactive in the figure 1[使得离群点之一在图1中的互动]
Splot = makeImap(Splot, figure=1, xy.type="circle", x.pos=3, y.pos=7,
x.labels = list(label="point", info="im a link"),
asLinks = "http://www.buffalo.edu", dir=direct,
y.labels = "7", fname.root="exToy", spot.radius=20,
font.type="arial", font.size="20",
font.color="hotpink", bg.color="blue")
# make polygon region interactive in figure 2 [在图2中,多边形区域互动]
Splot = makeImap(Splot, figure=2, xy.type="polygon",
x.pos=c(2,2.5,3,2.5), y.pos=c(1,2.5,1,1.5),
x.labels = as.data.frame(list(label = "Polygon")),
asLinks="http://www.bioinformatics.buffalo.edu",
y.labels = as.data.frame(list(value="data1",
info="Im alink")),
fname.root="exToy", dir=direct, bb.cex=5, font.size=30,
font.type="sans-serif", font.color="purple")
# make data set of three points interactive in figure 2 [使数据在图2三点互动]
x.lbls = as.data.frame(list(labels=c("point1", "point2", "points3"),
info=c("im a link", "im a link", "im alink"),
numVl = c("num1", "num2", "num3"),
num = c(1,2,3)))
y.links = as.data.frame(list(
hyp1=c("http://www.buffalo.edu",
"http://www.bioinformatics.buffalo.edu,http://www.buffalo.edu",
"http://www.bioinformatics.buffalo.edu"),
hyp2=c(NA, "http://www.buffalo.edu",NA)
))
asLinks=c("http://www.buffalo.edu",
"http://www.bioinformatics.buffalo.edu","http://www.buffalo.edu")
Splot = makeImap(Splot, figure=2, xy.type="points", x.pos=1:3, y.pos=1:3,
x.labels = x.lbls, y.links=y.links,asLinks=asLinks,
fname.root="exToy",bb.cex=5, spot.radius=20,dir=direct,
font.color="green",bg.color="", font.size="14")
# makes each box of image interactive in figure 3 [每个方块图3中的图像互动]
x.lbls=as.data.frame(list(Xnuml = 1:2,
Xvl2 = c("mx1", "mx2")))
y.lbls=as.data.frame(list(ynum1 = 1:3,
Yvl2 = c("my1", "my2", "my3")))
xy.lbls=list(label = matrix(c("image.box1","image.box2",
"image.box3","image.box4",
"image.box5","image.box6"),ncol=2),
numMat1 = matrix(1:6, ncol=2),
vlMat2 = matrix(c("xy1","xy2","xy3","xy4","xy5","xy6"),
ncol=2))
x.links=as.data.frame(list(
Xhyp1 = c("http://www.buffalo.edu,http://bioinformatics.buffalo.edu",
NA)))
y.links=as.data.frame(list(Yhyp2 = c(NA, "http//www.buffalo.edu", NA)))
xy.links=list(XYhyp = matrix(c(NA, "http://www.buffalo.edu", NA,
"http://buffalo.edu", NA, NA), ncol=2))
Splot = makeImap(Splot, figure=3, xy.type="image.box",
x.pos= c(.5,1.5,2.5), y.pos=c(.5,1.5,2.5,3.5),
x.labels=x.lbls, y.labels = y.lbls, xy.labels=xy.lbls,
x.links=x.links, y.links=y.links, xy.links=xy.links,
fname.root="exToy", bb.cex=5, spot.radius=10,dir=direct)
#[]
# add Default tool-tip [添加默认的工具提示]
#[]
Splot = addDefault(
Splot,
data=c("This is default", "data2"),
data.labels=c("label", "d2"),
links=c("http://www.buffalo.edu,http://www.bioinformatics.buffalo.edu",
"http://www.bioinformatics.buffalo.edu"),
links.labels=c("hyp1", "hyp2"),
font.size=10, font.type="arial", bg.color="gray", font.color="yellow")
#[]
#[]
# Now that regions have been set as interactive[现在,该区域已被设置为互动]
# make interactive html [使交互的HTML]
#[]
#[]
Splot = makeSplot(Splot, fname.root="exToy", dir=direct, returnObj=TRUE)
#[]
#[]
# Now demonstarte removing interactive regions for figures[现在demonstarte消除数字互动区域]
# Note: to see effect must remake plot with the makeSplot[注意:要看到效果,必须的翻拍绘制的makeSplot]
# above[以上]
# removes outlier point interactive in figure 1[在图1中删除离群点互动]
# since it was the second set added subset = 2[因为它是添加的子集的第二组= 2]
Splot = removeImap(Splot, figure=1, subset=2)
# remove default region toop-tip[删除默认的区域托普头]
Splot = removeImap(Splot, figure="Default")
# remove all interactive sets for figure 2[删除所有互动套图2]
Splot = removeImap(Splot, figure=2)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|