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

Drawing a self-edge removes labels

Open keorn opened this issue 5 years ago • 6 comments

After drawing a self-edge labels disappear from any subsequent drawn graphs. Requires a package reload to draw labels again.

keorn avatar May 16 '20 20:05 keorn

Thanks for this. Do you have a MWE? I am having a little difficulty replicating the problem,

n = 6
g = wheel_graph(n)

add_edge!(g,1,1)

graphplot(g) |> display
g2 = barabasi_albert(n,1)
graphplot(g2,edgelabel=Dict((1,2)=>"hello"))

works fine for me.

JackDevine avatar May 17 '20 05:05 JackDevine

Yeah, sorry didnt take time to narrow it down. I am plotting from LightGraphs. Will look more into it later today.

image

keorn avatar May 17 '20 07:05 keorn

Ok, got the minimal version (can go more minimal if needed):

using GraphRecipes, Plots
graphplot([[2], [2]]; names = ["a", "b"], edgelabel=Dict((2, 2) => "c", (1, 2) => "d"))

On the first draw already the loop and nodes labels are missing: image

All subsequent draws (even other graphs) do not display any labels: image

keorn avatar May 17 '20 16:05 keorn

The above was GR backend, just tried plotlyjs. This time it doesnt disappear, but the self-edge label ends up weirdly on the edge between nodes: image

keorn avatar May 17 '20 16:05 keorn

I don't know if it is related, but when I set edgelabel = some_mat with the GR backend it says:

Warning: Attribute alias `annotation` detected in the user recipe defined for the signature (::GraphRecipes.GraphPlot). To ensure expected behavior it is recommended to use the default attribute `annotations`.

And the edge labels are blank, like in the example above.

estradilua avatar Jul 24 '20 03:07 estradilua

It seems to be the problem with NaN when processing the edges. I have fixed this issue I think: https://github.com/congUoM/GraphRecipes.jl/commit/29b061a018738cd6798272affbb6236070214238

congv avatar Dec 20 '20 14:12 congv