Sizing vertices in threejs
As with all network visualizations it is often worth adjusting the size of vertices to illustrate their relative importance. This is also straightforward in threejs
. In this exercise you will create an interactive threejs plot of the karate club network and size vertices based on their relative eigenvector centrality.
Diese Übung ist Teil des Kurses
Network Analysis in R
Anleitung zur Übung
- Calculate the eigenvector centrality of each vertex using
eigen_centrality()
and store the values in the objectec
. - Using
sqrt()
adjust the values inec
to create a new vector of valuesv
which is equal to five times the square root of the original eigenvector centrality. - Plot the network using the
threejs
functiongraphjs
and making the argumentvertex.size
equal to the values in v.
Interaktive Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
# Create numerical vector of vertex eigenvector centralities
ec <- as.numeric(___(g)$___)
# Create new vector 'v' that is equal to the square-root of 'ec' multiplied by 5
v <- 5*___(___)
# Plot threejs plot of graph setting vertex size to v
___(g, vertex.size = ___)