Skip to content

feat: edge color by variable#614

Merged
JohnCoene merged 1 commit intoJohnCoene:masterfrom
teofiln:feature/no-ref/graph-layout-none
Jan 27, 2024
Merged

feat: edge color by variable#614
JohnCoene merged 1 commit intoJohnCoene:masterfrom
teofiln:feature/no-ref/graph-layout-none

Conversation

@teofiln
Copy link
Copy Markdown
Contributor

@teofiln teofiln commented Jan 23, 2024

Hi @JohnCoene

Please have a look at this PR. It allows the user to pass a color variable to map onto the edges color in e_graph, independent of node color. For example:

nodes <- data.frame(
    name = c("A", "B", "C", "D", "E"),
    value = c("A", "B", "C", "D", "E"),
    group = c("gr1", "gr1", "gr2", "gr2", "gr3"),
    size = 3:7 * 10,
    x = c(0, 200, 400, 600, 800),
    y = c(100, 100, 200, 200, 0)
)

edges <- data.frame(
    source = c("A", "B", "C", "D", "E"),
    target = c("B", "C", "D", "E", "D"),
    size = rep(3, 5),
    color = c("red", "green", "blue", "yellow", "black")
)

devtools::load_all()
e_charts() |>
    e_graph(layout = "none", autoCurveness = TRUE) |>
    e_graph_nodes(nodes, name, value, size, category = group, xpos = x, ypos = y) |>
    e_graph_edges(edges, source, target, size = size, color = color) |>
    e_tooltip()

image

@JohnCoene
Copy link
Copy Markdown
Owner

Looks good, thank you!

@JohnCoene JohnCoene merged commit 5b7194e into JohnCoene:master Jan 27, 2024
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

Successfully merging this pull request may close these issues.

2 participants