-
Notifications
You must be signed in to change notification settings - Fork 114
Closed
Description
I've been trying to build a pretty simple graph that uses styled text (a simple equation) on the edge labels, but the label_parse argument to geom_edge_link() doesn't seem to be working. Here's a reprex:
nodes = tibble::tibble(id=1:2, x=c(1,2), y=c(1,2), name=c('A', 'B'))
edges = tibble::tibble(from=1, to=2, lab = 'italic(B) == 1.04')
tidygraph::tbl_graph(nodes = nodes, edges = edges, directed=TRUE, node_key = 'id') %>%
ggraph::ggraph(layout='manual', x=x, y=y) +
ggraph::geom_edge_link(ggplot2::aes(label=lab), label_parse = TRUE, angle_calc = 'along', label_dodge = grid::unit(2.5, 'mm')) +
ggraph::geom_node_label(ggplot2::aes(label=name))
Digging into the code a tiny bit, it looks like the label_parse
argument for all of the edge geoms gets processed as part of the creating the ggproto GeomEdgePath
in the file geom_edge.R
. If I'm reading it correctly, starting on line 125, it checks to see if label_parse
is set to TRUE, and if so, parses the labels to expressions, saving the result as the variable lab_expressions
. But then I can't see where lab_expressions
is used anywhere else. Is that an oversight, or am I misunderstanding the code?
Metadata
Metadata
Assignees
Labels
No labels