From eff63036eec12af3bea1670b3121632564c2fff0 Mon Sep 17 00:00:00 2001 From: Brooks Ambrose Date: Sun, 27 Feb 2022 18:34:11 -0800 Subject: [PATCH] Fix broken indexing of edgelist coordinates The vertex coordinates `Xn` and `Yn` are indexed as if they are named vectors, but they aren't, so `NA` is returned instead of edge endpoints. This adds the names. --- r/2015-12-31-network-graph.Rmd | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/r/2015-12-31-network-graph.Rmd b/r/2015-12-31-network-graph.Rmd index 1399eb98..aa8c0d5d 100644 --- a/r/2015-12-31-network-graph.Rmd +++ b/r/2015-12-31-network-graph.Rmd @@ -45,6 +45,9 @@ library(plotly) Xn <- L[,1] Yn <- L[,2] +names(Xn)<-vs$name +names(Yn)<-vs$name + network <- plot_ly(x = ~Xn, y = ~Yn, mode = "markers", text = vs$label, hoverinfo = "text") ``` @@ -84,4 +87,4 @@ fig ``` ### Reference -See [https://plotly.com/python/reference/#scatter](https://plotly.com/python/reference/#scatter) for more information and chart attribute options! \ No newline at end of file +See [https://plotly.com/python/reference/#scatter](https://plotly.com/python/reference/#scatter) for more information and chart attribute options!