@@ -30,8 +30,11 @@ edge_color_mixer <- function(i, j, vcols, p = .5, alpha = .15) {
30
30
# ' @param vertex.nsides Numeric vector of length `vcount(x)`. Number of sizes of
31
31
# ' the vertex. E.g. three is a triangle, and 100 approximates a circle.
32
32
# ' @param vertex.color Vector of length `vcount(x)`. Vertex HEX or built in colors.
33
- # ' @param vertex.size.range Vector of length `vcount(x)` from 0 to 1.
34
- # ' @param vertex.frame.color Vector of length `vcount(x)`. Border of vertex in HEX or built in colors.
33
+ # ' @param vertex.size.range Numeric vector of length 3. Relative size for the
34
+ # ' minimum and maximum of the plot, and curvature of the scale. The third number
35
+ # ' is used as `size^rel[3]`.
36
+ # ' @param vertex.frame.color Vector of length `vcount(x)`. Border of vertex in
37
+ # ' HEX or built in colors.
35
38
# ' @param vertex.frame.prop Vector of length `vcount(x)`. What proportion of the
36
39
# ' vertex does the frame occupy (values between 0 and 1).
37
40
# ' @param vertex.rot Vector of length `vcount(x)` in Radians. Passed to [npolygon],
@@ -45,19 +48,24 @@ edge_color_mixer <- function(i, j, vcols, p = .5, alpha = .15) {
45
48
# ' top ranking according to `vertex.size`.
46
49
# ' @param vertex.label.range Numeric vector of size 2 or 3. Relative scale of
47
50
# ' `vertex.label.fontsize` in points (see [grid::gpar]).
48
- # ' @param edge.color A vector of length `ecount(x)`. In HEX or built in colors. Can be `NULL` in which case
51
+ # ' @param edge.color A vector of length `ecount(x)`. In HEX or built in colors.
52
+ # ' Can be `NULL` in which case
49
53
# ' the color is picked as a mixture between ego and alters' `vertex.color` values.
50
- # ' @param edge.width Vector of length `ecount(x)` from 0 to 1. All edges will be the same size.
51
- # ' @param edge.width.range Vector of length `ecount(x)` from 0 to 1. Adjusting width according to weight.
54
+ # ' @param edge.width Vector of length `ecount(x)` from 0 to 1. All edges will be
55
+ # ' the same size.
56
+ # ' @param edge.width.range Vector of length `ecount(x)` from 0 to 1. Adjusting
57
+ # ' width according to weight.
52
58
# ' @param edge.arrow.size Vector of length `ecount(x)` from 0 to 1.
53
59
# ' @param edge.curvature Numeric vector of length `ecount(x)`. Curvature of edges
54
60
# ' in terms of radians.
55
- # ' @param edge.line.lty Vector of length `ecount(x)`. Line types in R (e.g.- 1 = Solid, 2 = Dashed, etc)
61
+ # ' @param edge.line.lty Vector of length `ecount(x)`. Line types in R
62
+ # ' (e.g.- 1 = Solid, 2 = Dashed, etc).
56
63
# ' @param edge.line.breaks Vector of length `ecount(x)`. Number of vertices to
57
64
# ' draw (approximate) the arc (edge).
58
- # ' @param sample.edges Numeric scalar between 0 and 1. Proportion of edges to sample.
59
- # ' @param skip.vertex,skip.edges,skip.arrows Logical scalar. When `TRUE` the object
60
- # ' is not plotted.
65
+ # ' @param sample.edges Numeric scalar between 0 and 1. Proportion of edges to
66
+ # ' sample.
67
+ # ' @param skip.vertex,skip.edges,skip.arrows Logical scalar. When `TRUE` the
68
+ # ' object is not plotted.
61
69
# ' @param add Logical scalar.
62
70
# ' @param zero.margins Logical scalar.
63
71
# ' @importFrom igraph layout_with_fr degree vcount ecount
@@ -98,15 +106,15 @@ nplot <- function(
98
106
bg.col = " transparent" ,
99
107
vertex.nsides = 10 ,
100
108
vertex.color = grDevices :: hcl.colors(1 ),
101
- vertex.size.range = c(.01 , .03 ),
109
+ vertex.size.range = c(.01 , .03 , 4 ),
102
110
vertex.frame.color = NULL ,
103
111
vertex.rot = 0 ,
104
112
vertex.frame.prop = .2 ,
105
113
vertex.label = NULL ,
106
114
vertex.label.fontsize = NULL ,
107
- vertex.label.color = " black" ,
108
- vertex.label.fontfamily = " HersheySans " ,
109
- vertex.label.fontface = " bold " ,
115
+ vertex.label.color = adjustcolor( " black" , alpha.f = .80 ) ,
116
+ vertex.label.fontfamily = " sans " ,
117
+ vertex.label.fontface = " plain " ,
110
118
vertex.label.show = .3 ,
111
119
vertex.label.range = c(5 , 15 ),
112
120
edge.width = 1 ,
@@ -138,15 +146,15 @@ nplot.igraph <- function(
138
146
bg.col = " transparent" ,
139
147
vertex.nsides = 10 ,
140
148
vertex.color = grDevices :: hcl.colors(1 ),
141
- vertex.size.range = c(.01 , .03 ),
149
+ vertex.size.range = c(.01 , .03 , 4 ),
142
150
vertex.frame.color = NULL ,
143
151
vertex.rot = 0 ,
144
152
vertex.frame.prop = .2 ,
145
153
vertex.label = igraph :: vertex_attr(x , " name" ),
146
154
vertex.label.fontsize = NULL ,
147
- vertex.label.color = " black" ,
148
- vertex.label.fontfamily = " HersheySans " ,
149
- vertex.label.fontface = " bold " ,
155
+ vertex.label.color = adjustcolor( " black" , alpha.f = .80 ) ,
156
+ vertex.label.fontfamily = " sans " ,
157
+ vertex.label.fontface = " plain " ,
150
158
vertex.label.show = .3 ,
151
159
vertex.label.range = c(5 , 15 ),
152
160
edge.width = igraph :: edge_attr(x , " weight" ),
@@ -215,15 +223,15 @@ nplot.network <- function(
215
223
bg.col = " transparent" ,
216
224
vertex.nsides = 10 ,
217
225
vertex.color = grDevices :: hcl.colors(1 ),
218
- vertex.size.range = c(.01 , .03 ),
226
+ vertex.size.range = c(.01 , .03 , 4 ),
219
227
vertex.frame.color = NULL ,
220
228
vertex.rot = 0 ,
221
229
vertex.frame.prop = .2 ,
222
230
vertex.label = network :: get.vertex.attribute(x , " vertex.names" ),
223
231
vertex.label.fontsize = NULL ,
224
- vertex.label.color = " black" ,
225
- vertex.label.fontfamily = " HersheySans " ,
226
- vertex.label.fontface = " bold " ,
232
+ vertex.label.color = adjustcolor( " black" , alpha.f = .80 ) ,
233
+ vertex.label.fontfamily = " sans " ,
234
+ vertex.label.fontface = " plain " ,
227
235
vertex.label.show = .3 ,
228
236
vertex.label.range = c(5 , 15 ),
229
237
edge.width = 1 ,
@@ -288,15 +296,15 @@ nplot.matrix <- function(
288
296
bg.col = " transparent" ,
289
297
vertex.nsides = 10 ,
290
298
vertex.color = grDevices :: hcl.colors(1 ),
291
- vertex.size.range = c(.01 , .03 ),
299
+ vertex.size.range = c(.01 , .03 , 4 ),
292
300
vertex.frame.color = NULL ,
293
301
vertex.rot = 0 ,
294
302
vertex.frame.prop = .2 ,
295
303
vertex.label = NULL ,
296
304
vertex.label.fontsize = NULL ,
297
- vertex.label.color = " black" ,
298
- vertex.label.fontfamily = " HersheySans " ,
299
- vertex.label.fontface = " bold " ,
305
+ vertex.label.color = adjustcolor( " black" , alpha.f = .80 ) ,
306
+ vertex.label.fontfamily = " sans " ,
307
+ vertex.label.fontface = " plain " ,
300
308
vertex.label.show = .3 ,
301
309
vertex.label.range = c(5 , 15 ),
302
310
edge.width = 1 ,
@@ -399,7 +407,7 @@ netplot_theme <- (function() {
399
407
dev_size <- function (... ) {
400
408
401
409
if (length(grDevices :: dev.list())) {
402
-
410
+
403
411
grDevices :: dev.size(... )
404
412
405
413
} else
@@ -435,15 +443,15 @@ nplot.default <- function(
435
443
bg.col = " transparent" ,
436
444
vertex.nsides = 10 ,
437
445
vertex.color = grDevices :: hcl.colors(1 ),
438
- vertex.size.range = c(.01 , .03 ),
446
+ vertex.size.range = c(.01 , .03 , 4 ),
439
447
vertex.frame.color = NULL ,
440
448
vertex.rot = 0 ,
441
449
vertex.frame.prop = .2 ,
442
450
vertex.label = NULL ,
443
451
vertex.label.fontsize = NULL ,
444
- vertex.label.color = " black" ,
445
- vertex.label.fontfamily = " HersheySans " ,
446
- vertex.label.fontface = " bold " ,
452
+ vertex.label.color = adjustcolor( " black" , alpha.f = .80 ) ,
453
+ vertex.label.fontfamily = " sans " ,
454
+ vertex.label.fontface = " plain " ,
447
455
vertex.label.show = .3 ,
448
456
vertex.label.range = c(5 , 15 ),
449
457
edge.width = 1 ,
@@ -649,7 +657,7 @@ nplot.default <- function(
649
657
if (! skip.vertex ) {
650
658
grob.vertex <- vector(" list" , netenv $ N )
651
659
for (v in 1 : netenv $ N )
652
- grob.vertex [[v ]] <- grob_vertex(netenv , v )
660
+ grob.vertex [[v ]] <- grob_vertex(netenv , v )
653
661
} else
654
662
grob.vertex <- NULL
655
663
0 commit comments