I’m using gplot()
from the GraphPlot.jl
package to plot a graph created with LightGraphs.jl
. I’d like to change the font family used for the node labels, but can’t find in the documentation how to do that. Does anyone know?
Creating a PlotText object with text
should work, e.g. something like names = [text("Times", 12, name) for name in labels]
https://docs.juliaplots.org/latest/generated/gr/#gr-ref20-1
Thanks. Maybe I’m doing something, but I can’t get this to work. Here is a MWE:
using LightGraphs, GraphPlot, Compose
m = reshape(Int.(rand(Bool, 100)), (10, 10))
g = SimpleDiGraph(m)
labels = 1:10
names = [ text("Open Sans", 12, name) for name in labels ]
gplot(g, nodelabel=names)
This doesn’t give an error, but the labels in the resulting plot are not numbers but rather the whole text of the Compose
objects.
I’m sorry please ignore my post. I thought you used GraphRecipes.jl.