@@ -68,13 +68,18 @@ library(netplot)
68
68
set.seed(1 )
69
69
data(" UKfaculty" , package = " igraphdata" )
70
70
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...
71
74
72
75
plot(UKfaculty , layout = l ) # ala igraph
73
76
```
74
77
75
78
<img src =" man/figures/README-example-1.png " width =" 85% " />
76
79
77
80
``` r
81
+
82
+ V(UKfaculty )$ ss <- runif(vcount(UKfaculty ))
78
83
nplot(UKfaculty , layout = l ) # ala netplot
79
84
```
80
85
@@ -96,7 +101,7 @@ nam <- sample(babynames::babynames$name, vcount(UKfaculty))
96
101
ans <- nplot(
97
102
UKfaculty ,
98
103
layout = l ,
99
- vertex.color = grDevices :: hcl.colors( 5 , " Plasma " )[V( UKfaculty ) $ Group + 1 ] ,
104
+ vertex.color = ~ Group ,
100
105
vertex.label = nam ,
101
106
vertex.size.range = c(.01 , .04 , 4 ),
102
107
vertex.label.col = " black" ,
@@ -112,20 +117,7 @@ ans <- nplot(
112
117
ans
113
118
```
114
119
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% " />
129
121
130
122
Starting version 0.2-0, we can use gradients!
131
123
@@ -138,7 +130,7 @@ ans |>
138
130
}))
139
131
```
140
132
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% " />
142
134
143
135
### USairports
144
136
@@ -148,6 +140,9 @@ data(USairports, package="igraphdata")
148
140
149
141
# Generating a layout naively
150
142
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...
151
146
layout <- do.call(rbind , lapply(layout , function (x ) strsplit(x , " " )[[1 ]]))
152
147
layout [] <- stringr :: str_remove(layout , " ^[a-zA-Z]+" )
153
148
layout <- matrix (as.numeric(layout []), ncol = 2 )
@@ -170,7 +165,7 @@ net <- simplify(USairports, edge.attr.comb = list(
170
165
nplot(
171
166
net ,
172
167
layout = layout ,
173
- edge.width = E( net ) $ Passengers ,
168
+ edge.width = ~ Passengers ,
174
169
edge.color =
175
170
~ ego(col = " white" , alpha = 0 ) + alter(col = " yellow" , alpha = .75 ),
176
171
skip.vertex = TRUE ,
0 commit comments