@@ -202,7 +202,7 @@ function gplot(g::AbstractGraph{T},
202
202
end
203
203
204
204
# Create nodes
205
- nodecircle = fill (0.4 Compose . w , length (locs_x))
205
+ nodecircle = fill (0.4 * 2.4 , length (locs_x)) # 40% of the width of the unit box
206
206
if isa (nodesize, Real)
207
207
for i = 1 : length (locs_x)
208
208
nodecircle[i] *= nodesize
@@ -257,28 +257,31 @@ function gplot(g::AbstractGraph{T},
257
257
end
258
258
Compose. set_default_graphic_size (plot_size... )
259
259
260
- # Fix title offset
261
- title_offset = isempty (title) ? 0 : 0.1 * title_size/ 4
262
-
263
- # Plot area size
264
- plot_area = (- 1.2 , - 1.2 - title_offset, + 2.4 , + 2.4 + title_offset)
260
+ # Plot title
261
+ title_offset = isempty (title) ? 0 : 0.1 * title_size/ 4 # Fix title offset
262
+ title = text (0 , - 1.2 - title_offset/ 2 , title, hcenter, vcenter)
265
263
266
264
# Plot padding
267
265
if ! isnothing (pad)
268
266
leftpad, rightpad, toppad, bottompad = pad, pad, pad, pad
269
267
end
268
+
269
+ # Plot area size
270
+ plot_area = (- 1.2 , - 1.2 - title_offset, + 2.4 , + 2.4 + title_offset)
270
271
271
272
# Build figure
272
- compose (context (units= UnitBox (plot_area... ; leftpad, rightpad, toppad, bottompad)),
273
- compose (context (), text (0 , - 1.2 - title_offset/ 2 , title, hcenter, vcenter), fill (title_color), fontsize (title_size), font (font_family)),
274
- compose (context (), texts, fill (nodelabelc), fontsize (nodelabelsize), font (font_family)),
275
- compose (context (), nodes, fill (nodefillc), stroke (nodestrokec), linewidth (nodestrokelw)),
276
- compose (context (), edgetexts, fill (edgelabelc), fontsize (edgelabelsize)),
277
- compose (context (), larrows, stroke (edgestrokec), linewidth (edgelinewidth)),
278
- compose (context (), carrows, stroke (edgestrokec), linewidth (edgelinewidth)),
279
- compose (context (), lines, stroke (edgestrokec), linewidth (edgelinewidth)),
280
- compose (context (), curves, stroke (edgestrokec), linewidth (edgelinewidth)),
281
- compose (context (units= UnitBox (plot_area... )), rectangle (plot_area... ), fill (background_color)))
273
+ compose (
274
+ context (units= UnitBox (plot_area... ; leftpad, rightpad, toppad, bottompad)),
275
+ compose (context (), title, fill (title_color), fontsize (title_size), font (font_family)),
276
+ compose (context (), texts, fill (nodelabelc), fontsize (nodelabelsize), font (font_family)),
277
+ compose (context (), nodes, fill (nodefillc), stroke (nodestrokec), linewidth (nodestrokelw)),
278
+ compose (context (), edgetexts, fill (edgelabelc), fontsize (edgelabelsize)),
279
+ compose (context (), larrows, stroke (edgestrokec), linewidth (edgelinewidth)),
280
+ compose (context (), carrows, stroke (edgestrokec), linewidth (edgelinewidth)),
281
+ compose (context (), lines, stroke (edgestrokec), linewidth (edgelinewidth)),
282
+ compose (context (), curves, stroke (edgestrokec), linewidth (edgelinewidth)),
283
+ compose (context (units= UnitBox (plot_area... )), rectangle (plot_area... ), fill (background_color))
284
+ )
282
285
end
283
286
284
287
function gplot (g; layout:: Function = spring_layout, keyargs... )
0 commit comments