@@ -23,6 +23,18 @@ Layout algorithm. Currently can be one of [`random_layout`,
23
23
`spectral_layout`].
24
24
Default: `spring_layout`
25
25
26
+ `title`
27
+ Plot title. Default: `""`
28
+
29
+ `title_color`
30
+ Plot title color. Default: `colorant"black"`
31
+
32
+ `title_size`
33
+ Plot title size. Default: `4.0`
34
+
35
+ `font_family`
36
+ Font family for all text. Default: `"Helvetica"`
37
+
26
38
`NODESIZE`
27
39
Max size for the nodes. Default: `3.0/sqrt(N)`
28
40
@@ -97,6 +109,10 @@ Default: `π/5 (36 degrees)`
97
109
"""
98
110
function gplot (g:: AbstractGraph{T} ,
99
111
locs_x_in:: Vector{R1} , locs_y_in:: Vector{R2} ;
112
+ title = " " ,
113
+ title_color = colorant " black" ,
114
+ title_size = 4.0 ,
115
+ font_family = " Helvetica" ,
100
116
nodelabel = nothing ,
101
117
nodelabelc = colorant " black" ,
102
118
nodelabelsize = 1.0 ,
@@ -227,12 +243,14 @@ function gplot(g::AbstractGraph{T},
227
243
end
228
244
end
229
245
230
- compose (context (units= UnitBox (- 1.2 , - 1.2 , + 2.4 , + 2.4 )),
231
- compose (context (), texts, fill (nodelabelc), stroke (nothing ), fontsize (nodelabelsize)),
246
+ title_offset = isempty (title) ? 0 : 0.1 * title_size/ 4
247
+ compose (context (units= UnitBox (- 1.2 , - 1.2 - title_offset, + 2.4 , + 2.4 + title_offset)),
248
+ compose (context (), text (0 , - 1.2 - title_offset/ 2 , title, hcenter, vcenter), fill (title_color), fontsize (title_size), font (font_family)),
249
+ compose (context (), texts, fill (nodelabelc), fontsize (nodelabelsize), font (font_family)),
232
250
compose (context (), nodes, fill (nodefillc), stroke (nodestrokec), linewidth (nodestrokelw)),
233
- compose (context (), edgetexts, fill (edgelabelc), stroke ( nothing ), fontsize (edgelabelsize )),
251
+ compose (context (), edgetexts, fill (edgelabelc), fontsize (edgelabelsize ), font (font_family )),
234
252
compose (context (), arrows, stroke (edgestrokec), linewidth (edgelinewidth)),
235
- compose (context (), lines, stroke (edgestrokec), fill ( nothing ), linewidth (edgelinewidth)))
253
+ compose (context (), lines, stroke (edgestrokec), linewidth (edgelinewidth)))
236
254
end
237
255
238
256
function gplot (g; layout:: Function = spring_layout, keyargs... )
0 commit comments