Skip to content

Commit f1ff04b

Browse files
committed
Updating README
1 parent 2df4a68 commit f1ff04b

6 files changed

+12
-17
lines changed

README.md

+12-17
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,18 @@ library(netplot)
6868
set.seed(1)
6969
data("UKfaculty", package = "igraphdata")
7070
l <- layout_with_fr(UKfaculty)
71+
#> This graph was created by an old(er) igraph version.
72+
#> Call upgrade_graph() on it to use with the current igraph version
73+
#> For now we convert it on the fly...
7174

7275
plot(UKfaculty, layout = l) # ala igraph
7376
```
7477

7578
<img src="man/figures/README-example-1.png" width="85%" />
7679

7780
``` r
81+
82+
V(UKfaculty)$ss <- runif(vcount(UKfaculty))
7883
nplot(UKfaculty, layout = l) # ala netplot
7984
```
8085

@@ -96,7 +101,7 @@ nam <- sample(babynames::babynames$name, vcount(UKfaculty))
96101
ans <- nplot(
97102
UKfaculty,
98103
layout = l,
99-
vertex.color = grDevices::hcl.colors(5, "Plasma")[V(UKfaculty)$Group + 1],
104+
vertex.color = ~ Group,
100105
vertex.label = nam,
101106
vertex.size.range = c(.01, .04, 4),
102107
vertex.label.col = "black",
@@ -112,20 +117,7 @@ ans <- nplot(
112117
ans
113118
```
114119

115-
<img src="man/figures/README-unnamed-chunk-1-1.png" width="85%" />
116-
117-
``` r
118-
119-
# With a legend
120-
nplot_legend(
121-
ans,
122-
labels = paste("Group", 1:4),
123-
pch = c(21, 21, 21),
124-
gp = grid::gpar(fill = grDevices::hcl.colors(5, "Plasma")[2:4])
125-
)
126-
```
127-
128-
<img src="man/figures/README-unnamed-chunk-1-2.png" width="85%" />
120+
<img src="man/figures/README-unnamed-chunk-1-1.png" width="85%" /><img src="man/figures/README-unnamed-chunk-1-2.png" width="85%" />
129121

130122
Starting version 0.2-0, we can use gradients!
131123

@@ -138,7 +130,7 @@ ans |>
138130
}))
139131
```
140132

141-
<img src="man/figures/README-uk-faculty-gradient-1.png" width="85%" />
133+
<img src="man/figures/README-uk-faculty-gradient-1.png" width="85%" /><img src="man/figures/README-uk-faculty-gradient-2.png" width="85%" />
142134

143135
### USairports
144136

@@ -148,6 +140,9 @@ data(USairports, package="igraphdata")
148140

149141
# Generating a layout naively
150142
layout <- V(USairports)$Position
143+
#> This graph was created by an old(er) igraph version.
144+
#> Call upgrade_graph() on it to use with the current igraph version
145+
#> For now we convert it on the fly...
151146
layout <- do.call(rbind, lapply(layout, function(x) strsplit(x, " ")[[1]]))
152147
layout[] <- stringr::str_remove(layout, "^[a-zA-Z]+")
153148
layout <- matrix(as.numeric(layout[]), ncol=2)
@@ -170,7 +165,7 @@ net <- simplify(USairports, edge.attr.comb = list(
170165
nplot(
171166
net,
172167
layout = layout,
173-
edge.width = E(net)$Passengers,
168+
edge.width = ~ Passengers,
174169
edge.color =
175170
~ ego(col = "white", alpha = 0) + alter(col = "yellow", alpha = .75),
176171
skip.vertex = TRUE,

man/figures/README-example-2.png

-29 Bytes
Loading

man/figures/README-example-3.png

130 Bytes
Loading
-22.5 KB
Loading
-22 KB
Loading
6.88 KB
Loading

0 commit comments

Comments
 (0)