Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Distance between nodes #147

Open
Hofsmo opened this issue May 14, 2021 · 1 comment
Open

Distance between nodes #147

Hofsmo opened this issue May 14, 2021 · 1 comment

Comments

@Hofsmo
Copy link

Hofsmo commented May 14, 2021

Hi,
I really like GraphRecipes for plotting smaller electric networks. However, when the number of vertices increases the graphs get unreadable. This could easily be fixed if I could change the distance between the vertices. I have been looking a lot, but not figured out to do this. I was therefore wondering if anyone knows how to change the distance between the vertices?

Cheers Sigurd

@JackDevine
Copy link
Member

The formatter tries to make the vertices as far apart as possible. You can change the method used with the method keyword argument, which may give a better layout for your graph. Other than that the two levers that I tend to use are the nodesize and the size of the plot, which gives the formatter more room to work with.

using Plots
using GraphRecipes
using LightGraphs

g = watts_strogatz(800,2,0.01)

Compare the following plots of the graph:

graphplot(g,method=:spring)

example

graphplot(g,size=(1000,1000),curvature=false,method=:spring,nodesize=0.05)

example

Beyond that, you could consider manually passing the x-y coordinates of the graph

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants