如何在 rbokeh 中指定字形层的顺序?
How to specify order of glyph layers in rbokeh?
我正在尝试使用 rbokeh
包构建网络可视化。
library(igraph)
library(rbokeh)
library(dplyr)
g <- random.graph.game(n=100,p=0.3)
L <- as.data.frame(igraph::layout_with_fr(g)) %>% rename(x=V1,y=V2)
url1 <- 'http://icons.veryicon.com/png/Business/Flat%20Finance/person.png'
p <- figure(xlab = "x", ylab = "y", height = 500,width=1000,xgrid=F,ygrid=F,webgl = T,
xaxes = F,yaxes = F,h_symmetry = T,v_symmetry = T) %>%
ly_lines(x = L$x,y=L$y,color = '#FFA700', width = 4, alpha = 0.2) %>%
ly_image_url(x = L$x, y=L$y, image_url = url1, w = rep(0.1,vcount(g)), h=rep(0.2,vcount(g)),
anchor = "center",lname = 'nodes')
除了线条绘制在图像字形之上之外,生成的可视化效果看起来符合预期。有没有一种方法可以控制图层的视觉顺序,使节点(图像)绘制在顶部,线条绘制在后面?
这里的问题是使用 webgl = TRUE
。有关更多详细信息,请参阅 Bokeh documentation(同时参阅 "support" 和 "notes" 部分。要点是并非所有字形都可以使用 WebGL 呈现(对于线条是,对于图像不是) 以及 "Glyphs drawn using WebGL are drawn on top of glyphs that are not drawn in WebGL."
如果你摆脱了webgl = TRUE
,你的身材应该很好!
另外,为了进一步回答关于如何控制图层顺序的整体问题,答案是在像这样的边缘情况之外,其中一个图层是用 WebGL 渲染的,而另一个不是,图层是在它们指定的顺序。
我正在尝试使用 rbokeh
包构建网络可视化。
library(igraph)
library(rbokeh)
library(dplyr)
g <- random.graph.game(n=100,p=0.3)
L <- as.data.frame(igraph::layout_with_fr(g)) %>% rename(x=V1,y=V2)
url1 <- 'http://icons.veryicon.com/png/Business/Flat%20Finance/person.png'
p <- figure(xlab = "x", ylab = "y", height = 500,width=1000,xgrid=F,ygrid=F,webgl = T,
xaxes = F,yaxes = F,h_symmetry = T,v_symmetry = T) %>%
ly_lines(x = L$x,y=L$y,color = '#FFA700', width = 4, alpha = 0.2) %>%
ly_image_url(x = L$x, y=L$y, image_url = url1, w = rep(0.1,vcount(g)), h=rep(0.2,vcount(g)),
anchor = "center",lname = 'nodes')
除了线条绘制在图像字形之上之外,生成的可视化效果看起来符合预期。有没有一种方法可以控制图层的视觉顺序,使节点(图像)绘制在顶部,线条绘制在后面?
这里的问题是使用 webgl = TRUE
。有关更多详细信息,请参阅 Bokeh documentation(同时参阅 "support" 和 "notes" 部分。要点是并非所有字形都可以使用 WebGL 呈现(对于线条是,对于图像不是) 以及 "Glyphs drawn using WebGL are drawn on top of glyphs that are not drawn in WebGL."
如果你摆脱了webgl = TRUE
,你的身材应该很好!
另外,为了进一步回答关于如何控制图层顺序的整体问题,答案是在像这样的边缘情况之外,其中一个图层是用 WebGL 渲染的,而另一个不是,图层是在它们指定的顺序。