@@ -23,6 +23,18 @@ Layout algorithm. Currently can be one of [`random_layout`,
2323`spectral_layout`]. 
2424Default: `spring_layout` 
2525
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+ 
2638`NODESIZE` 
2739Max size for the nodes. Default: `3.0/sqrt(N)` 
2840
@@ -97,6 +109,10 @@ Default: `π/5 (36 degrees)`
97109""" 
98110function  gplot (g:: AbstractGraph{T} ,
99111    locs_x_in:: Vector{R1} , locs_y_in:: Vector{R2} ;
112+     title =  " " 
113+     title_color =  colorant "" 
114+     title_size =  4.0 ,
115+     font_family =  " Helvetica" 
100116    nodelabel =  nothing ,
101117    nodelabelc =  colorant "" 
102118    nodelabelsize =  1.0 ,
@@ -216,8 +232,10 @@ function gplot(g::AbstractGraph{T},
216232        lines, larrows =  build_straight_edges (g, locs_x, locs_y, nodesize, arrowlengthfrac, arrowangleoffset)
217233    end 
218234
219-     compose (context (units= UnitBox (- 1.2 , - 1.2 , + 2.4 , + 2.4 )),
220-             compose (context (), texts, fill (nodelabelc), stroke (nothing ), fontsize (nodelabelsize)),
235+     title_offset =  isempty (title) ?  0  :  0.1 * title_size/ 4 
236+     compose (context (units= UnitBox (- 1.2 , - 1.2  -  title_offset, + 2.4 , + 2.4  +  title_offset)),
237+             compose (context (), text (0 , - 1.2  -  title_offset/ 2 , title, hcenter, vcenter), fill (title_color), fontsize (title_size), font (font_family)),
238+             compose (context (), texts, fill (nodelabelc), fontsize (nodelabelsize), font (font_family)),
221239            compose (context (), nodes, fill (nodefillc), stroke (nodestrokec), linewidth (nodestrokelw)),
222240            compose (context (), edgetexts, fill (edgelabelc), stroke (nothing ), fontsize (edgelabelsize)),
223241            compose (context (), larrows, stroke (edgestrokec), linewidth (edgelinewidth)),
0 commit comments