I finally have access to a computer with Julia on it!
I was able to solve your problem on master.
My solution is very hacky. Basically, there are two problems:
- Whenever you have all of the nodes in a line, GraphRecipes makes the window size too small and cuts all of the nodes in half.
- Edges don’t try to avoid each other as discussed above.
Problem 1 is a bug and is probably worth filing an issue on the repo for. Problem 2 is a missing feature and could also get its own issue.
The way I got around both problems is by creating ghost nodes that are there but can’t be seen. To get around problem one I placed a ghost node off to the side of the visible nodes that forced GraphRecipes to expand the window size. I then set self_edges_size=0
, so that you don’t see the self loop for that node. To get around problem 2 I placed a ghost node (node 6) to the side of node 4 and instead of having an edge 5\to3 I made edges 5\to6 and 6\to4.
Here is my code:
using GraphRecipes
using Plots
using LightGraphs
pyplot()
# You had WheelGraph here, but I don't think that is what you intended?
g = DiGraph(7)
add_edge!(g, 1, 2)
add_edge!(g, 2, 3)
add_edge!(g, 3, 4)
add_edge!(g, 4, 5)
# Instead of adding an edge 5 -> 3, have an edge that goes from 5 to
# the ghost node, then to 3.
add_edge!(g, 5, 6)
add_edge!(g, 6, 3)
# Add an edge by itself that will force GraphRecipes to have a decent
# window size.
add_edge!(g, 7, 7)
names = [:Thing, :Thingy, :Thinger, :Things, :Stuff, "", ""]
x = [0,0,0,0,0,2,6]
y = [5,4,3,2,1,2,1]
graphplot(g, x=x, y=y, curvature_scalar=0.0, nodesize=0.5,
node_weights=[0.5,0.5,0.5,0.5,0.5,0.0,0.0],
names=names, nodecolor=:lightgray, color=:black,
nodeshape=:rect, self_edge_size=0.0)