@@ -222,35 +222,26 @@ function gplot(g::AbstractGraph{T},
222
222
end
223
223
224
224
# Create lines and arrow heads
225
- lines, arrows = nothing , nothing
225
+ lines, larrows = nothing , nothing
226
+ curves, carrows = nothing , nothing
226
227
if linetype == " curve"
227
- if arrowlengthfrac > 0.0
228
- curves_cord, arrows_cord = graphcurve (g, locs_x, locs_y, nodesize, arrowlengthfrac, arrowangleoffset, outangle)
229
- lines = curve (curves_cord[:,1 ], curves_cord[:,2 ], curves_cord[:,3 ], curves_cord[:,4 ])
230
- arrows = line (arrows_cord)
231
- else
232
- curves_cord = graphcurve (g, locs_x, locs_y, nodesize, outangle)
233
- lines = curve (curves_cord[:,1 ], curves_cord[:,2 ], curves_cord[:,3 ], curves_cord[:,4 ])
234
- end
228
+ curves, carrows = build_curved_edges (g, locs_x, locs_y, nodesize, arrowlengthfrac, arrowangleoffset, outangle)
229
+ elseif has_self_loops (g)
230
+ lines, larrows, curves, carrows = build_straight_curved_edges (g, locs_x, locs_y, nodesize, arrowlengthfrac, arrowangleoffset, outangle)
235
231
else
236
- if arrowlengthfrac > 0.0
237
- lines_cord, arrows_cord = graphline (g, locs_x, locs_y, nodesize, arrowlengthfrac, arrowangleoffset)
238
- lines = line (lines_cord)
239
- arrows = line (arrows_cord)
240
- else
241
- lines_cord = graphline (g, locs_x, locs_y, nodesize)
242
- lines = line (lines_cord)
243
- end
232
+ lines, larrows = build_straight_edges (g, locs_x, locs_y, nodesize, arrowlengthfrac, arrowangleoffset)
244
233
end
245
234
246
235
title_offset = isempty (title) ? 0 : 0.1 * title_size/ 4
247
236
compose (context (units= UnitBox (- 1.2 , - 1.2 - title_offset, + 2.4 , + 2.4 + title_offset)),
248
237
compose (context (), text (0 , - 1.2 - title_offset/ 2 , title, hcenter, vcenter), fill (title_color), fontsize (title_size), font (font_family)),
249
238
compose (context (), texts, fill (nodelabelc), fontsize (nodelabelsize), font (font_family)),
250
239
compose (context (), nodes, fill (nodefillc), stroke (nodestrokec), linewidth (nodestrokelw)),
251
- compose (context (), edgetexts, fill (edgelabelc), fontsize (edgelabelsize), font (font_family)),
252
- compose (context (), arrows, stroke (edgestrokec), linewidth (edgelinewidth)),
253
- compose (context (), lines, stroke (edgestrokec), linewidth (edgelinewidth)))
240
+ compose (context (), edgetexts, fill (edgelabelc), stroke (nothing ), fontsize (edgelabelsize)),
241
+ compose (context (), larrows, stroke (edgestrokec), linewidth (edgelinewidth)),
242
+ compose (context (), carrows, stroke (edgestrokec), linewidth (edgelinewidth)),
243
+ compose (context (), lines, stroke (edgestrokec), fill (nothing ), linewidth (edgelinewidth)),
244
+ compose (context (), curves, stroke (edgestrokec), fill (nothing ), linewidth (edgelinewidth)))
254
245
end
255
246
256
247
function gplot (g; layout:: Function = spring_layout, keyargs... )
0 commit comments