Description Usage Arguments Note Author(s) See Also Examples
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.
navGraph
will call at any bullet state change a function the
user defines in the global environment.
The executed function should contain plot instruction and have any subset of these arguments
argument | description |
x | x-coordinate |
y | y-coordinate |
group | group slot from NG_data object |
labels | labels slot from NG_data object |
order | order of points. In 3d rigid rotation, the order increases with the distance of a the point from the viewer. |
from | node name the bullet moves from |
to | node name the bullet moves to |
percentage | in between percentage of bullet |
data | data name of NG_data object |
1 | ng_2d_myplot(data, graph, fnName, device = "base", scaled = TRUE)
|
data |
NG_data object. |
graph |
NG_graph object. |
fnName |
Character sting of the function name defined in the global
environment |
device |
One of the following choices: "base", "grid", "ggplot2", "lattice" or "rgl". |
scaled |
Logical. If TRUE, scaled x and y coordinates get passed to the
function |
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.
Adrian Waddell and R. Wayne Oldford
navGraph
, ng_data
, ng_graph
,
ng_get-methods
, ng_set-methods
, ng_2d
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | library(grid)
## 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
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
nav <- navGraph(ng.iris,ng.lg, viz1)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.