|
| 1 | +--- |
| 2 | +output: github_document |
| 3 | +--- |
| 4 | + |
| 5 | +<!-- README.md is generated from README.Rmd. Please edit that file --> |
| 6 | + |
| 7 | +```{r, include = FALSE} |
| 8 | +knitr::opts_chunk$set( |
| 9 | + collapse = TRUE, |
| 10 | + comment = "#>", |
| 11 | + fig.path = "man/figures/README-", |
| 12 | + out.width = "100%" |
| 13 | +) |
| 14 | +``` |
| 15 | + |
| 16 | +# easylayout: Publication-Ready Networks Directly in your IDE |
| 17 | + |
| 18 | +<!-- badges: start --> |
| 19 | +[](https://github.com/dalmolingroup/easylayout/actions/workflows/R-CMD-check.yaml) |
| 20 | +<!-- badges: end --> |
| 21 | + |
| 22 | +Easylayout is an R package that seamlessly bridges manipulation and |
| 23 | +visualization by leveraging the user's IDE itself (e.g., RStudio, VSCode). It |
| 24 | +is **not** yet another visualization library, but instead aims to interconnect |
| 25 | +existing libraries and streamline their usage into the R ecosystem. Easylayout |
| 26 | +takes an igraph object and serializes it into a web application integrated with |
| 27 | +the IDE's interface through a Shiny server. The web application lays out the |
| 28 | +network by simulating attraction and repulsion forces. Simulation parameters |
| 29 | +can be adjusted in real-time. An editing mode allows moving and rotating nodes. |
| 30 | +The implementation aims for performance, so that even lower-end devices are |
| 31 | +able to work with relatively large networks. Once the user finishes tinkering |
| 32 | +the layout, it is sent back to the R session to be plotted through popular |
| 33 | +libraries like ggplot2 or even the base package itself. |
| 34 | + |
| 35 | +## Installation |
| 36 | + |
| 37 | +You can install the development version of easylayout from [GitHub](https://github.com/) with: |
| 38 | + |
| 39 | +```r |
| 40 | +# install.packages("devtools") |
| 41 | +devtools::install_github("daniloimparato/easylayout", ref = "main") |
| 42 | +``` |
| 43 | + |
| 44 | +## Example |
| 45 | + |
| 46 | +This is a basic example which shows you how to solve a common problem: |
| 47 | + |
| 48 | +```{r example, eval = FALSE} |
| 49 | +library(easylayout) |
| 50 | +library(igraph) |
| 51 | +
|
| 52 | +g <- igraph::erdos.renyi.game(n = 5000, p.or.m = 10000, type = "gnm") |
| 53 | +
|
| 54 | +number_of_vertices <- igraph::vcount(g) |
| 55 | +
|
| 56 | +igraph::V(g)$label <- NA |
| 57 | +igraph::V(g)$size <- sample(1:5, number_of_vertices, replace = TRUE) |
| 58 | +igraph::V(g)$color <- sample(rainbow(5), number_of_vertices, replace = TRUE) |
| 59 | +
|
| 60 | +plot(g, layout = easylayout) |
| 61 | +``` |
| 62 | + |
| 63 | +## Future work |
| 64 | + |
| 65 | +The current implementation focuses on the R ecosystem, but using web |
| 66 | +technologies makes it easily portable to similar environments, like Jupyter |
| 67 | +Notebooks. We expect this tool to reduce the time spent tweaking network |
| 68 | +layouts, allowing researches to generate more compelling figures. |
0 commit comments