2

I want to create an RMarkdown html document. When I create a rmarkdown document with tabs at the top but the visualization doesn't appear in the second tab. Although when I do not have tabs, the visualization is fine. How do I include the visualization in the 2nd tab?

Reproducible code below:

---
title: "StackOverflow Example"
output: html_document
---

## Demand Team Analytics {.tabset}

### Overview

```{r}
summary(cars)
```

### Prediction Analytics

```{r, message = FALSE, include = FALSE, warning=FALSE}
library(igraph)
library(visNetwork)
B = matrix( 
c(1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 47, 3, 0, 3, 0, 1, 10, 13, 5,
0, 3, 19, 0, 1, 0, 1, 7, 3, 1,
0, 0, 0, 3, 0, 0, 0, 0, 0, 0,
0, 3, 1, 0, 32, 0, 0, 3, 2, 1,
0, 0, 0, 0, 0, 2, 0, 0, 0, 0,
0, 1, 1, 0, 0, 0, 2, 1, 1, 0,
0, 10, 7, 0, 3, 0, 1, 90, 12, 4, 
0, 13, 3, 0, 2, 0, 1, 12, 52, 4, 
0, 5, 1, 0, 1, 0, 0, 4, 4, 18), 
nrow=10, 
ncol=10)
colnames(B) <- c("A", "B", "C", "D", "E", "F", "G", "H", "I", "J")
rownames(B) <- c("A", "B", "C", "D", "E", "F", "G", "H", "I", "J")

g96e = t(B) %*% B

i96e = graph.adjacency(g96e, mode = "undirected", weighted = TRUE, diag=FALSE)

V(i96e)$label = V(i96e)$name
V(i96e)$label.color = rgb(0,0,.2,.8)
V(i96e)$label.cex = .1
V(i96e)$size = 2
V(i96e)$color = rgb(0,0,1,.5)
V(i96e)$frame.color = V(i96e)$color
fc<-fastgreedy.community(i96e, merges=TRUE, modularity=TRUE,
                 membership=TRUE, weights=E(i96e)$weight)
colors <- rainbow(max(membership(fc)))

col = c("#80FF00FF", "#FF0000FF", "#FF0000FF", "#00FFFFFF",
"#FF0000FF", "#8000FFFF", "#FF0000FF", "#FF0000FF",
"#FF0000FF", "#FF0000FF")
i96e <- set.vertex.attribute(i96e, name = "group",value = col)
i96e = graph.adjacency(g96e, mode = "undirected", weighted = TRUE, diag=FALSE)
i96e <- set.vertex.attribute(i96e, name = "group",value = col)
```

```{r, echo=FALSE}
visIgraph(i96e, idToLabel = F, layout = "layout_nicely") %>%
  visOptions(highlightNearest = TRUE, selectedBy = "group")
```

enter image description here

When I remove the {.tabset} text next to ## Demand Team Analytics, it works but there are no tabs.

This is what it looks like with no tabs:

enter image description here

Any help would be great, thanks!

nak5120
  • 4,089
  • 4
  • 35
  • 94
  • Hi. It seems there is this problem only using `visIgraph` and/or `visIgraphLayout`. I think there is a bad interaction with this options, the coordinates computation and rescale, and the tab. I'll have a look when have time. – bthieurmel Oct 14 '16 at 07:35
  • @bthieurmel thanks, please let me know! – nak5120 Oct 15 '16 at 14:08
  • Normally fix on dev ``1.0.3``. ``devtools::install_github("datastorm-open/visNetwork")`` – bthieurmel Nov 29 '16 at 16:54

0 Answers0