Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Danilo Imparato <13784115+daniloimparato@users.noreply.github.com>
  • Loading branch information
jvfe and daniloimparato authored Dec 3, 2024
1 parent d6049fd commit 3658d0e
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ igraph::V(g)$color <- sample(rainbow(5), number_of_vertices, replace = TRUE)
plot(g, layout = easylayout, vertex.label = NA, margin = 0)
```

You can also run easylayout as a function and attribute the results to a
variable, containing the layout itself:
You can also run easylayout as a standalone function, attributing its output
to a variable in your R environment. The output is just a 2-column matrix:

``` r
layout <- easylayout(g)
Expand All @@ -67,12 +67,11 @@ network. In the example below, we set the x and y values to node
attributes and plot the network using ggraph.

``` r
V(g)$x <- layout[, 1]
V(g)$y <- layout[, 2]

ggraph::ggraph(g, layout = "manual", x = V(g)$x, y = V(g)$y) +
ggraph::ggraph(g, layout = layout) +
ggraph::geom_edge_link() +
ggraph::geom_node_point()
ggraph::geom_node_point(aes(color = color)) +
ggplot2::coord_fixed() +
ggplot2::theme_void()
```

## Future work
Expand Down

0 comments on commit 3658d0e

Please sign in to comment.