Skip to content

Customize network layout, currently only spring layout #2243

@rmhopkins4

Description

@rmhopkins4

Currently, without implementing a custom drawer, networks are always drawn with the spring layout. A way to customize this would be well appreciated, whether it be in the agent_portrayal or in the model itself (which does somewhat violate the separation of model & visualization).

## matplotlib.py

# draws using networkx's matplotlib integration
def _draw_network_grid(space, space_ax, agent_portrayal):
    graph = space.G
    pos = nx.spring_layout(graph, seed=0)
    nx.draw(
        graph,
        ax=space_ax,
        pos=pos,
        **agent_portrayal(graph),
    )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions