GraphRecipes.jl icon indicating copy to clipboard operation
GraphRecipes.jl copied to clipboard

Nodes with not labels are not drawn

Open diegozea opened this issue 2 years ago • 1 comments

As the node sizes are scaled to fit their labels, nodes without labels aren't drawn. Maybe we can use a minimum node size to handle those cases. Example of the problem:

image

Code (Plots 1.25.11 and GraphRecipes 0.5.9):

using Graphs, Plots, GraphRecipes
graph = smallgraph(:karate)
begin
	node_labels = fill("", nv(graph))
	node_labels[1] = "Mr. Hi"
	node_labels[34] = "John A"
end
graphplot(graph, names=node_labels)

diegozea avatar Feb 24 '22 17:02 diegozea

As a workaround can add a space when you fill the array:

using Graphs, Plots, GraphRecipes
graph = smallgraph(:karate)
begin
	node_labels = fill(" ", nv(graph)) # <------- note the space difference 
	node_labels[1] = "Mr. Hi"
	node_labels[34] = "John A"
end
graphplot(graph, names=node_labels)

Tested with plotly and with gr.

originalsouth avatar Mar 03 '22 16:03 originalsouth