text3d(vrmlgen)
text3d()所属R语言包:vrmlgen
Draw text in a 3D-scene
在3D场景绘制文本
译者:生物统计家园网 机器人LoveR
描述----------Description----------
text3d plots text in a 3D-scene in the VRML- or Livegraphics3D-format. Must be called after vrml.open() or lg3d.open() and before vrml.close() or lg3d.close().
text3d图在三维场景中的VRML或Livegraphics3D的格式文本。必须调用后vrml.open()或lg3d.open()和的vrml.close()或lg3d.close(前)。
用法----------Usage----------
text3d(x, y = NULL, z = NULL, text, col = "black",
fontweight = "normal", fontfamily = "sans",
hyperlink = NULL, rot = c(0, 1, 0, 0), scale = 1)
参数----------Arguments----------
参数:x
a 3-column numeric matrix of coordinates or a numeric vector of x-coordinates
具有3列的数值矩阵的坐标或一个数值向量的x坐标
参数:y
a numeric vector of y-coordinates (only needed if x is a vector)
一个数值向量的y坐标(只需要如果x是一个向量)
参数:z
a numeric vector of z-coordinates (only needed if x is a vector)
一个数值向量的z坐标(如果只需要x是一个向量)
参数:text
a vector of strings which are to be plotted (size must correspond to the number of coordinates specified in the x-, y-, and z-parameters
要绘制的字符串的向量(大小必须对应于对数坐标中指定的x-,γ-,和z-参数
参数:col
the color of the text
文本的颜色
参数:fontweight
"normal" or "bold"
“正常”或“大胆”
参数:fontfamily
"sans", "serif" or "typewriter"
“无”,“衬线”或“打字机”
参数:hyperlink
a string containing a hyperlink to a website
一个字符串,其中包含一个超链接到一个网站
参数:rot
a numeric vector of length 4, the first 3 components specify a rotation axis and the last component is the rotation angle in radians
一个数值向量的长度为4,第3的组件指定一个旋转轴线和最后一个组件是旋转角度以弧度
参数:scale
a numerical scaling factor to increase/decrease the text size
数值的缩放因子,以增加/减少的文本大小
Details
详细信息----------Details----------
text3d draws one or multiple text strings in a 3D-scene in the VRML- or Livegraphics3D-format. This function can be used to add additional labels to plots or to attach textual information to a 3D-shape or object. text3d can only be applied within a VRML- or Livegraphics3D-environment created by calling the vrml.open() or lg3d.open() function and closed using the vrml.close() or lg3d.close() function.
text3d在3D场景中的VRML或Livegraphics3D的格式绘制一个或多个文本字符串。此功能可以用于添加额外的标签的图或文字信息附加到一个3D形状或对象。 text3d只能适用于内的VRML或Livegraphics3D的环境调用vrml.open()或lg3d.open()函数和封闭使用的vrml.close()或lg3d.close()函数创建的。
值----------Value----------
The function is used for its side-effect (writing text in a VRML- or Livegraphics3D-file) and has no return value.
该功能用于其副作用(在的VRML或Livegraphics3D的文件写入文本),并没有返回值。
(作者)----------Author(s)----------
Enrico Glaab
参考文献----------References----------
3D Data Visualization on the Web. Journal of Statistical Software, 36(8), p. 1-18. URL: http://www.jstatsoft.org/v36/i08/
参见----------See Also----------
points3d, lines3d
points3d,lines3d
实例----------Examples----------
curdir <- getwd()
outdir <- tempdir()
setwd(outdir)
# This example loads the atom coordinates of a molecule[例如加载一个分子的原子坐标]
# (C60, fullerene) and visualizes the molecule in 3D[富勒烯(C60,富勒烯)和在3D可视化的分子]
# using points for the atoms and lines for the atom bonds[使用点的原子和原子的线]
# (atom pairs within a given distance threshold).[(原子对给定距离内的阈值)。]
vrml.open(file = "c60.wrl", navigation = "EXAMINE",
html.embed = "c60example.html")
# load dataset[负载数据集]
data(c60coords)
# plot the atoms as black spheres[绘制原子的黑球]
points3d(c60coords, col = "black")
# plot the atom bonds as gray lines[灰线绘制原子]
# (for all atom pairs with a Euclidean distance < 0.66)[(所有原子对一个欧氏距离<0.66)]
for(j in 1nrow(c60coords) - 1))
{
for(k in (j + 1):nrow(c60coords))
{
if(sqrt(sum((c60coords[j,]-c60coords[k,])^2)) < 0.66)
lines3d(c60coords[c(j,k),], col = "gray", lwd = 1)
}
}
vrml.close()
# show the output in a web-browser [在Web浏览器中显示的输出]
# (VRML-plugin must be installed!)[(VRML插件必须安装!)]
if(file.exists(paste("file://",file.path(outdir,
"c60example.html"), sep = "")))
{
browseURL(paste("file://",file.path(outdir,
"c60example.html"), sep = ""))
}
setwd(curdir)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|