Popup- NetworkD3 with ggplot2

Asked by At

Hi I want to enrich my networkD3 networks with pre-built plots from ggplot2. How can I do this ? I created a little example


# Create simulated data
src <- c("A", "A", "A", "A",
         "B", "B", "C", "C", "D")
target <- c("B", "C", "D", "J",
            "E", "F", "G", "H", "I")
networkData <- data.frame(src, target)

# Plot

## Create for each node a ggplot2 boxplot
nodes <- c("A","B","C", "D", "E","F","G","H","I","J")
dflist <- lapply(nodes,function(x){data.frame(x,rnorm(10))})
metadf <- do.call("rbind",dflist)
colnames(metadf) <- c("node","value")

plotList <- list()
for(n in nodes){
  plotList[[n]] <- ggplot(subset(metadf,node ==n),aes(x=node,y=value))+ geom_boxplot()

When I click on a node I would like a tool tip (popup) which shows the pre-built ggplot2 plot.

0 Answers