Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

label_parse for edges? #245

Closed
tarball11 opened this issue May 26, 2020 · 1 comment
Closed

label_parse for edges? #245

tarball11 opened this issue May 26, 2020 · 1 comment

Comments

@tarball11
Copy link

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?

@tarball11
Copy link
Author

tarball11 commented Nov 12, 2020 via email

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

No branches or pull requests

1 participant