ng_2d_myplot(RnavGraph)
ng_2d_myplot()所属R语言包:RnavGraph
Visualization instruction for 2d scatterplots on a user defined display
二维散点图用户的可视化指令定义的显示
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Visualization instruction for a navGraph session that link the nodes of a navigation graph to 2d scatterplots and the edges to a 3d rigid rotation or a 4d transition.
链接导航图以二维散点图和一个三维的刚性旋转或4d过渡的边缘节点的navGraph届的可视化指令。
navGraph will call at any bullet state change a function the user defines in the global environment.
navGraph将子弹在任何状态改变,用户定义函数在全球环境中。
The executed function should contain plot instruction and have any subset of these arguments
执行功能应包含绘图指令和这些参数的任意子集
用法----------Usage----------
ng_2d_myplot(data, graph, fnName, device = "base", scaled = TRUE)
参数----------Arguments----------
参数:data
NG_data object.
NG_data对象。
参数:graph
NG_graph object.
NG_graph对象。
参数:fnName
Character sting of the function name defined in the global environment .GlobalEnv. If a function with the name fnName.init also exists, it gets called to initialize the plots.
在全球环境中.GlobalEnv定义的函数名的字符刺。如果一个函数的名称fnName.init还存在,它被调用到初始化的图。
参数:device
One of the following choices: "base", "grid", "ggplot2", "lattice" or "rgl".
以下选择:“碱基”,“网格”,“ggplot2”,“格”或“RGL”之一。
参数:scaled
Logical. If TRUE, scaled x and y coordinates get passed to the function fnName which lie within the rectangle defined by (-1,-1) and (1,1).
逻辑。如果TRUE,缩放的x和y坐标开始浏览传递给函数的fnName位于由(-1,-1)和(1,1)定义的矩形内。
注意----------Note----------
Note that the base graphic device (including grid, ggplot2 and the lattice device) don't have double buffering implemented in Linux and OSX but in Windows they have. Hence, in Windows you will get smooth plots. But in OSX the plots only flush to the screen after a certain idle time from writing data to the device. In Linux, the device gets updated after every plot command but the user will experience a white flickering from redrawing the plot.
需要注意的是基本图形设备(包括grid,ggplot2和lattice设备)不实现在Linux和OSX的双缓冲,但在Windows中,他们有。因此,在Windows中,你会得到平滑的图。但在OSX的图只刷新到屏幕上写入数据到设备后,在一定的空闲时间。在Linux中,设备得到更新后,每一个图命令,但用户将体验到一个白色闪烁重绘的图。
(作者)----------Author(s)----------
Adrian Waddell and R. Wayne Oldford
参见----------See Also----------
navGraph, ng_data, ng_graph, ng_get-methods, ng_set-methods, ng_2d, ng_2d_ggobi
navGraph,ng_data,ng_graph,ng_get-methods,ng_set-methods,ng_2d,ng_2d_ggobi
实例----------Examples----------
library(grid)
## NG_data[#NG_data]
ng.iris <- ng_data(name = "iris", data = iris[,1:4],
shortnames = c('s.L', 's.W', 'p.L', 'p.W'),
group = iris$Species,
labels = substr(iris$Species,1,2))
## NG_graph[#NG_graph]
V <- shortnames(ng.iris)
G <- completegraph(V)
LG <- linegraph(G)
LGnot <- complement(LG)
ng.lg <- ng_graph(name = '3D Transition', graph = LG, layout = 'circle')
ng.lgnot <- ng_graph(name = '4D Transition', graph = LGnot, layout = 'circle')
## initialization plot[#初始化图]
myPlot.init <- function(x,y,group,labels,order) {
pushViewport(plotViewport(c(5,4,2,2)))
pushViewport(dataViewport(c(-1,1),c(-1,1),name="plotRegion"))
grid.points(x,y, name = "dataSymbols")
grid.rect()
grid.xaxis()
grid.yaxis()
grid.edit("dataSymbols", pch = 19)
grid.edit("dataSymbols", gp = gpar(col = group))
}
## update plot[#更新图]
myPlot <- function(x,y,group,labels,order) {
print(order)
grid.edit("dataSymbols",
x = unit(x,"native"),
y = unit(y,"native"))
}
## Visualization instruction[#可视化指令]
viz1 <- ng_2d_myplot(ng.iris,ng.lg,fnName = "myPlot",
device = "grid", scaled=TRUE)
## navGraph session[#navGraph会议]
nav <- navGraph(ng.iris,ng.lg, viz1)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|