【发布时间】:2017-09-26 00:44:33
【问题描述】:
我有一个闪亮的应用程序,其中我有一个使用ggraph 呈现的网络图,类似于下面的应用程序:
library(ggraph)
library(igraph)
library(shiny)
ui <- fluidPage(
plotOutput("plot", brush = brushOpts(id = "plot_brush"))
)
server <- function(input, output) {
graph <- graph_from_data_frame(highschool)
output$plot <- renderPlot({
ggraph(graph) +
geom_edge_link(aes(colour = factor(year))) +
geom_node_point()
})
observe(print(
brushedPoints(as_data_frame(graph, what = "vertices"), input$plot_brush)
)
)
}
shinyApp(ui, server)
我想做的是,当您在图表中单击并拖动以捕获某些节点时,我可以检查有关捕获的那些特定点的更多信息。目前,我只使用observe({print()}),以便在控制台中查看捕获的内容。
我的问题,每当我在应用程序中选择一个区域时,无论选择的区域中包含多少个节点,控制台都会返回 0 行。如何让它返回所选区域中包含的节点?
【问题讨论】: