Closed Lecrapouille closed 2 months ago
Thanks for pointing these out. #186 will allow you to make a plot like the first one with straight edges for the non-self loops, and curved edges for the self loops. The cut out can be fixed in the PR as well because you can add margins to ensure the curved edges are fully shown.
However, the edge labels on curved edges don't work as expected. Thanks for pointing this out. I'll see if we can get curved edge labels to work.
@Lecrapouille,
I just stumbled upon GraphMakie.jl, which seems to be more actively developed and has better support for curved edges. Here is your example in GraphMakie
using Graphs, GraphMakie, CairoMakie
B = [3 7; 2 4]
g = SimpleDiGraph(B)
graphplot(g,
layout = g -> [Point(-1,0), Point(1,0)],
nlabels = string.("node ",1:nv(g)),
elabels = string.([B[src(e),dst(e)] for e in edges(g)]),
elabels_rotation=0,
arrow_shift=0.99,
curve_distance = 0.1,
selfedge_size=1,
selfedge_width=pi/9
)
This will produce the plot:
You can of course do much more customization on the appearance if you want. Now the edge labels will be in the right place.
@hdavid16 Thanks you I'll give a try.
@Lecrapouille, I've added a commit to the PR #186 that will produce the following. This should fix the bug on the edge labels for curved edges.
B = [3 7; 2 4]
g = SimpleDiGraph(B)
gplot(g, [-1.,1.], [0.,0.],
nodelabel=1:nv(g),
edgelabel=B,
linetype="curve",
EDGELINEWIDTH=1,
outangle=-pi/3,
pad=5mm
)
Hi ! Again to disturb you. Here is my matrix:
Which corresponds to the expected network.![Expected](https://user-images.githubusercontent.com/17874458/196570846-cfaebe42-a88b-4f48-882a-8d5573c14b63.png)
The following code
gives me:![Obtained1](https://user-images.githubusercontent.com/17874458/196570958-5d69be85-0c2c-4053-b2b6-5acc8806473e.png)
Issues are:
Based on https://github.com/JuliaGraphs/GraphPlot.jl/issues/160 The following code
gives me:![Obtained2](https://user-images.githubusercontent.com/17874458/196571194-0d57b499-7def-484a-a423-f93b87dac3ba.png)
There are:
I dunno if https://github.com/JuliaGraphs/GraphPlot.jl/pull/186 will fix this simple graph.