Skip to content

Commit a75a927

Browse files
authored
Update methodshub.qmd
Fixed an incorrect formatting of the code chunks
1 parent 939668f commit a75a927

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

methodshub.qmd

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
engine: knitr
23
format:
34
html:
45
embed-resources: true
@@ -83,7 +84,7 @@ This object is essentially a data frame that contains the x–y coordinates of e
8384

8485
With R installed:
8586

86-
```r
87+
```{r}
8788
install.packages("graphlayouts")
8889
```
8990

@@ -98,7 +99,7 @@ After installing the package and its dependencies you can start visualizing netw
9899
### Create or load a graph
99100
Graphs can be created manually or loaded from existing datasets. For example:
100101

101-
```r
102+
```{r}
102103
library(igraph)
103104
g <- make_ring(10) # simple ring graph with 10 nodes
104105
```
@@ -112,7 +113,7 @@ Use `create_layout()` from `ggraph` with one of the following layout options pro
112113
- `"backbone"` – highlights the backbone structure of a network while de-emphasizing weaker connections.
113114
- `"centrality"` – arranges nodes according to a chosen centrality measure (e.g., degree or betweenness).
114115

115-
```r
116+
```{r}
116117
library(graphlayouts)
117118
library(ggraph)
118119
@@ -125,7 +126,7 @@ With a layout prepared, you can visualize the graph using `ggraph` layers.
125126
- **Nodes**: use `geom_node_point()` for basic dots, `geom_node_text()` for labels, or scale aesthetics (size, color, fill) by node attributes.
126127
- **Edges**: use `geom_edge_link()` for straight lines, `geom_edge_arc()` for curved arcs, or directional edges with arrows.
127128

128-
```r
129+
```{r}
129130
ggraph(lay) +
130131
geom_edge_link(alpha = 0.5) +
131132
geom_node_point(size = 5, color = "steelblue") +
@@ -136,7 +137,7 @@ ggraph(lay) +
136137
You can customize almost every aspect of the plot:
137138
- **Node size or color** can map to graph metrics:
138139

139-
```r
140+
```{r}
140141
V(g)$deg <- degree(g)
141142
ggraph(lay) +
142143
geom_edge_link(alpha = 0.3) +

0 commit comments

Comments
 (0)