8000 doc: extending w/ igraph · FRBCesab/chessboard@2fe27a2 · GitHub
[go: up one dir, main page]

Skip to content

Commit

Permalink
doc: extending w/ igraph
Browse files Browse the repository at this point in the history
  • Loading branch information
ahasverus committed Sep 6, 2023
1 parent 7a0a96e commit 2fe27a2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Imports:
tidyr
Suggests:
knitr,
igraph,
patchwork,
rmarkdown,
testthat (>= 3.0.0)
Expand Down
22 changes: 16 additions & 6 deletions vignettes/chessboard.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ All plotting functions in `chessboard` are produced with the `ggplot2` engine
and are highly customizable. For instance, let's change the default theme.


```{r 'change-theme', fig.height=8, fig.width=8, fig.cap="Figure 12. Connectivity matrix", out.width='80%'}
```{r 'change-theme', fig.height=8, fig.width=8, fig.cap="Figure 12. Custom connectivity matrix", out.width='80%'}
# Change default ggplot2 theme ----
gg_matrix(conn_matrix) +
theme_bw() +
Expand All @@ -651,21 +651,31 @@ gg_matrix(conn_matrix) +

### with `igraph`

...
The package `igraph` is commonly use to analyze network data. User can use the
function [`igraph::graph_from_data_frame()`] to convert the edge list created
with `chessboard` to an `igraph` object.

```{r 'to-igraph', fig.height=8, fig.width=8, fig.cap="Figure 13. igraph graph", out.width='80%'}
# Convert edge list to igraph object ----
igraph_obj <- igraph::graph_from_data_frame(d = edges,
directed = TRUE,
vertices = nodes)
\
# Check -----
class(igraph_obj)
print(igraph_obj)
### with `spdep`
# Plot the graph w/ igraph ----
plot(igraph_obj)
```

...


\


### with `adespatial`
### with `spdep`

...

Expand Down

0 comments on commit 2fe27a2

Please sign in to comment.
0