在 threejs 中調整頂點大小
和所有網路視覺化一樣,調整頂點大小常能更清楚呈現相對重要性。在 threejs 中也很容易達成。本練習要你建立空手道社群網路的互動式 threejs 圖,並依各自的特徵向量中心性來設定頂點大小。
本練習屬於課程
R 的 Network Analysis
練習說明
- 使用
eigen_centrality()計算每個頂點的特徵向量中心性,並將數值存到物件ec。 - 使用
sqrt()調整ec的數值,建立新的向量v,其值等於原始特徵向量中心性的平方根再乘以 5。 - 使用
threejs的graphjs函式繪製網路,並將引數vertex.size設為 v 中的數值。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# 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 = ___)