Comments (1)
The following is a minimally reproducible example where I have removed all of the code that converts the raw data into node and edges. I have also left out code that adjusts the physics.
library(visNetwork)
Build nodes
nodes <- data.frame(
id=c("C", "G", "NP", "D", "E1", "E2"),
label=c("C", "G", "NP", "D", "E1", "E2"),
size = c(45.095856, 37.859089, 116.437705,
1.546333, 1.373999, 23.07729),
color.background = c("cyan", "blue", "brown4",
"lightgreen", "lightgreen", "lightgreen")
)
Build edges
edges <- data.frame(
to = c('C', 'C', 'C', 'D', 'D', 'E1', 'E1',
'E2', 'E2', 'G', 'G', 'NP'),
from = c('D', 'G', 'NP', 'C', 'E1',
'C', 'E2', 'C', 'E1', 'C', 'NP', 'C'),
width = c(5.135724, 5.629823, 13.597379, 12.25, 12.4,
15.97265, 6.712251, 10, 13.333333, 19.62963, 6.666667, 20),
arrows = "to",
font_multi = "html",
color = c('lightgreen', 'blue', 'brown4', 'cyan', 'lightgreen', 'cyan',
'lightgreen', 'cyan', 'lightgreen', 'cyan', 'brown4', 'cyan')
)
visNetwork(nodes, edges)
Code where color works
Build nodes
nodes <- data.frame(
id=c("C", "G", "NP", "D", "E1", "E2"),
label=c("C", "G", "NP", "D", "E1", "E2"),
size = c(45.095856, 37.859089, 116.437705,
1.546333, 1.373999, 23.07729),
color.background = c("cyan", "blue", "brown",
"lightgreen", "lightgreen", "lightgreen")
)
Build edges
edges <- data.frame(
to = c('C', 'C', 'C', 'D', 'D', 'E1', 'E1',
'E2', 'E2', 'G', 'G', 'NP'),
from = c('D', 'G', 'NP', 'C', 'E1',
'C', 'E2', 'C', 'E1', 'C', 'NP', 'C'),
width = c(5.135724, 5.629823, 13.597379, 12.25, 12.4,
15.97265, 6.712251, 10, 13.333333, 19.62963, 6.666667, 20),
arrows = "to",
font_multi = "html",
color = c('lightgreen', 'blue', 'brown', 'cyan', 'lightgreen', 'cyan',
'lightgreen', 'cyan', 'lightgreen', 'cyan', 'brown', 'cyan')
)
visNetwork(nodes, edges)
from visnetwork.
Related Issues (20)
- Adding Two Search Bars to Networks
- Specifying Order of Points in visNetwork
- Can't change figure size in R markdown HOT 1
- Network background image
- arrows.to.type Documentation HOT 1
- Node labels cause extreme node sizes, and can't use ellipsis on node labels HOT 1
- Default colors listed in visNodes() documentation still incorrect
- Edge Labels in VisNetwork?
- Display information of the nodes when an edge is selected HOT 1
- Highlight Edges with Color Column HOT 1
- Access network instance from script
- HOWTO receive event when node is selected HOT 1
- Is it possible to rotate FontAwesome icons with visNetwork?
- Does anyone know how to save a drag and drop graph in Rshiny after drawing a flowchart with visNetwork
- `visHclust()` throws `Error in match.names(clabs, names(xi)) : names do not match previous names` when using reference manual code
- Blank visNetwork in RStudio HOT 1
- When node is selected, only label highlighted edges and only display direct edges
- problems with color of the border of nodes in visLegend
- Multiple SelectedBy within one visNetwork html page
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from visnetwork.