I have the following code to draw a directed graph with edge weights.
## Load the packages
using Random
using CairoMakie
using GraphMakie
using Graphs
using LaTeXStrings
using Colors
## Create a random directed graph
vnum = 4
enum = 6
ilabels = string.('a':'z')[1:vnum]
seed = 1234
g = erdos_renyi(4, 6, is_directed = true, seed = seed)
Random.seed!(seed)
elabels = LaTeXString.(string.(rand(1:10, enum)))
## Plot the data
font_size = 32
fig, ax, p = graphplot(
g;
ilabels = ilabels,
ilabels_fontsize = font_size,
elabels = elabels,
elabels_fontsize = font_size,
node_color = :orange,
edge_color = :gray,
edge_width = 4,
node_strokewidth = 4,
arrow_shift = :end,
arrow_size = 40,
);
hidedecorations!(ax);
hidespines!(ax);
colsize!(fig.layout, 1, Aspect(1, 1.0));
resize_to_layout!(fig);
fig
My question is how can I change the figure size? I have tried to add size
parameter to graphplot
without success.
Also, as you can see, the nodes in the picture gets cut off when they are too large. Is there any way to avoid this?
Thank you!