Skip to content

Add outset parameter to nodes #226

@henrik-wolf

Description

@henrik-wolf

Sometimes, I want to create a small separation between nodes and edges when plotting a graph, while keeping an outline around my nodes. Currently, I am using a workaround like this:

    f = Figure()
    ax = Axis(f[1, 1])
    g = cycle_digraph(3)

    # get fixed layout
    coords = GraphMakie.NetworkLayout.Spring()(g)
    # draw edges with large, white nodes
    graphplot!(ax, g; node_color = (:white, 1), arrow_shift = :end, node_size = 60, arrow_size = 20, layout = coords)
    # draw nodes on top
    graphplot!(ax, g; node_size = 20, arrow_size = 0, edge_width = 0, layout = coords)
    hidedecorations!(ax)
    hidespines!(ax)
    ax.aspect = DataAspect()
    f

Which creates this image:
Image

This works well enough, but the illusion breaks down quickly once there are things in the background of the plot, which the white nodes are overlapping with.

Would it make sense to add a outset or node_outset parameter to graphplot which shifts the endpoints of incoming and outgoing edges by some amount?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions