Skip to content

Commit

Permalink
Change rgl.* functions to *3d, update igraph pckg.
Browse files Browse the repository at this point in the history
  • Loading branch information
zaynabhammoud committed Jan 19, 2023
1 parent 37a833e commit e0a61f1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
inst/doc
doc
Meta
/doc/
/Meta/
13 changes: 6 additions & 7 deletions R/mully_visualization.R
Original file line number Diff line number Diff line change
Expand Up @@ -168,23 +168,23 @@ plot3d <- function(g, layers = TRUE,
if(length(V(g))==0){
stop("This mully Graph has no nodes.")
}
open3d()
bg3d(
rgl::open3d()
rgl::bg3d(
sphere = TRUE,
color = c("white", "blue"),
lit = FALSE,
back = "lines"
)
gps = getMarkGroups(g)

nLayers=dim(g$layers)[1]
colrs = randomColor(count = g$iLayer)

assignedColors=V(g)$color
usedCols = unique(assignedColors)
if (is.null(V(g)$color))
V(g)$color = NA

for (i in 1:dim(g$layers)[1]) {
for (i in 1:nLayers) {
idLayer=as.integer(g$layers$ID[i])
nodesid=which(V(g)$n == idLayer)
if(is.null(nodesid) || length(nodesid)==0)
Expand Down Expand Up @@ -277,7 +277,7 @@ plot3d <- function(g, layers = TRUE,
coord = t(as.matrix(layout1[temp, ]))
else
coord = as.matrix(layout1[temp:(temp + nNodes - 1), ])
plane = suppressWarnings(get3DPlane(coord, dim(g$layers)[1],nNodes))
plane = get3DPlane(coord, nLayers,nNodes)
planes3d(
0,
b = plane[2],
Expand All @@ -287,13 +287,12 @@ plot3d <- function(g, layers = TRUE,
alpha = 0.2
)
#Add layers' names
text3d(
rgl::text3d(
x = -max(abs(layout[, 1]))-1,
y = coord[1, 2],
z = min(abs(layout[, 3])) - 2,
texts = paste0(nameLayer," Layer",sep=""),
color = clrs[iColr],
alpha = 1
)
iColr=iColr+1
temp = temp + nNodes
Expand Down
9 changes: 4 additions & 5 deletions mully.Rcheck/00_pkg_src/mully/R/mully_visualization.R
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,7 @@ plot3d <- function(g, layers = TRUE,
if(length(V(g))==0){
stop("This mully Graph has no nodes.")
}
rgl.open()
rgl.bg(
rgl::bg3d(
sphere = TRUE,
color = c("white", "blue"),
lit = FALSE,
Expand Down Expand Up @@ -225,7 +224,7 @@ plot3d <- function(g, layers = TRUE,

layout = get3DLayout(g,vertex.plac)

open3d()
rgl::open3d()
igraph::rglplot(
g,
vertex.color = V(g)$color,
Expand Down Expand Up @@ -262,7 +261,7 @@ plot3d <- function(g, layers = TRUE,
else
coord = as.matrix(layout1[temp:(temp + nNodes - 1), ])
plane = suppressWarnings(get3DPlane(coord, dim(g$layers)[1],nNodes))
rgl.planes(
rgl::planes3d(
0,
b = plane[2],
0,
Expand All @@ -271,7 +270,7 @@ plot3d <- function(g, layers = TRUE,
alpha = 0.2
)
#Add layers' names
text3d(
rgl::texts3d(
x = -max(abs(layout[, 1]))-1,
y = coord[1, 2],
z = min(abs(layout[, 3])) - 2,
Expand Down

0 comments on commit e0a61f1

Please sign in to comment.