Skip to content

Commit

Permalink
Allow networks with multi-relational edges to be plotted
Browse files Browse the repository at this point in the history
Concat all relations of an edge to a single string to determine the edges
color by, since ggplot2 does not accept lists as an identifier.

Signed-off-by: Maximilian Löffler <[email protected]>
  • Loading branch information
maxloeffler committed Mar 22, 2024
1 parent 503ab2a commit 58d77b0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion util-plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
## Copyright 2018 by Barbara Eckl <[email protected]>
## Copyright 2018 by Thomas Bock <[email protected]>
## Copyright 2020-2021 by Thomas Bock <[email protected]>
## Copyright 2024 by Maximilian Löffler <[email protected]>
## All Rights Reserved.


Expand Down Expand Up @@ -142,7 +143,7 @@ plot.get.plot.for.network = function(network, labels = TRUE) {
if (igraph::ecount(network) > 0) {
p = p +
ggraph::geom_edge_fan(
mapping = ggplot2::aes(colour = relation, linetype = edge.type, width = 0.3 + 0.5 * log(weight)),
mapping = ggplot2::aes(colour = paste(relation, sep = " "), linetype = edge.type, width = 0.3 + 0.5 * log(weight)),
end_cap = ggraph::circle(PLOT.VERTEX.SIZE + 3, "pt"),
start_cap = ggraph::circle(PLOT.VERTEX.SIZE + 3, "pt"),
arrow = if (igraph::is.directed(network)) {
Expand Down

0 comments on commit 58d77b0

Please sign in to comment.