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

Add lattice layouts for plotting #179

Closed
maximelucas opened this issue Sep 27, 2022 · 8 comments
Closed

Add lattice layouts for plotting #179

maximelucas opened this issue Sep 27, 2022 · 8 comments
Labels
new feature New feature or request

Comments

@maximelucas
Copy link
Collaborator

Add an easy way to plot grid, triangular, and other regular lattices with a natural layout.

@maximelucas maximelucas added the new feature New feature or request label Sep 27, 2022
@maximelucas
Copy link
Collaborator Author

I think the way to do this is rather to have generators of lattice models that also output the positions of the nodes. Those positions can then be passed to any drawing function. I would close this an open another issue to suggest implementing lattice generators.

@leotrs
Copy link
Collaborator

leotrs commented Mar 27, 2023

You mean to attach the coordinates to each node as a node attribute?

@maximelucas
Copy link
Collaborator Author

Exactly. For example networkx has a with_positions argument:
nx.triangular_lattice_graph(m, n, with_positions=True)
https://networkx.org/documentation/stable/reference/generated/networkx.generators.lattice.triangular_lattice_graph.html

@leotrs
Copy link
Collaborator

leotrs commented Mar 27, 2023

And once the lattice is generated, there's a special plotting function that looks at the node attributes?

@maximelucas
Copy link
Collaborator Author

maximelucas commented Mar 27, 2023

Networkx does not have one, as far as I know. So you need to manually collect all the positions, and pass them to the draw function with the pos argument. But I agree we could have "lattice draw" functions that do that automatically, or a helper function that collects the positions from node attribute in a format that fits the pos argument.

@leotrs
Copy link
Collaborator

leotrs commented Mar 28, 2023

Alternatively, we could have a pos argument that works much like edge_fc et al in draw_xgi_simplices, that is, it could take a dict, a NodeStat, etc. This could be useful for plotting in general, not only for lattice networks.

@maximelucas
Copy link
Collaborator Author

We have a recipe doing this for triangular lattices now.

@nwlandry
Copy link
Collaborator

Closed as per the team meeting today.

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

No branches or pull requests

3 participants