GraphPlot.jl
GraphPlot.jl copied to clipboard
Trouble fitting labels inside the picture
I'm using draw(PNG("myGraph.png", 200, 200), gplot(g)) and have trouble fitting the nodelabels entirely inside the frame of the picture, see below. Is there a way to fix this?
Thanks, this package is awesome!
@PeterNorlindh a quick workaround would be to use join.(split.(labels,"_"),"\n")
. This would split your labels by underscore and then join each segment on a newline.
@PeterNorlindh
Another option is to use nodelabeldist
along with nodelabelangleoffset
to offset the labels:
As an example:
gplot(
path_digraph(3),
[1,2,3], #x coord
[1,2,3], #y coord
nodelabel=["ABCDEFGHI","JKLMNOP","QRSTUVWXYZ"],
nodelabeldist=[2.5,0,-2.7], #shift the first node 2.5 to the right, middle node 0 units, right node 2.7 to left
nodelabelangleoffset=0 #label along the horizontal center line of the nodes
)
Will produce the plot:
If you are satisfied, feel free to close the issue. Thanks for the great question!
Closed by #186