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

Need someway to feed labels into layout spec #32

Closed
hadley opened this issue Jan 26, 2017 · 2 comments
Closed

Need someway to feed labels into layout spec #32

hadley opened this issue Jan 26, 2017 · 2 comments

Comments

@hadley
Copy link

hadley commented Jan 26, 2017

Ideally here the arrows would touch the closest side of the label.

library(igraph)
#> 
#> Attaching package: 'igraph'
#> The following objects are masked from 'package:stats':
#> 
#>     decompose, spectrum
#> The following object is masked from 'package:base':
#> 
#>     union
library(ggraph)
#> Loading required package: ggplot2

gr <- make_graph('bull')
E(gr)$class <- sample(letters[1:3], gsize(gr), replace = TRUE)
V(gr)$class <- sample(letters[1:3], gorder(gr), replace = TRUE)

ggraph(gr, 'igraph', algorithm = 'nicely') +
  geom_edge_link0(arrow = grid::arrow(length = unit(0.5, "cm"), type = "closed")) + 
  geom_node_label(aes(label = class), repel = TRUE, label.padding = unit(1, "lines"))

@thomasp85
Copy link
Owner

Related to #20

I would like to solve this more generally and due to the different types of edges I don't think moving the end point directly will cut it... I do have some ideas for a responsive path grob that I need to look into...

All in all I really don't like arrowheads due to this as well as the clutter they introduce, but for very simple graphs they have their merit so they should get better support...

@thomasp85 thomasp85 mentioned this issue Feb 9, 2017
thomasp85 added a commit that referenced this issue Feb 9, 2017
Fixes #20 and #32 

* Add cappedPathGrob

* Adding end cutters

* Add geometry specs

* Add cappedPathGrob

* Use cappedPathGrob in GeomEdgePath

* Fix geometry implementation

* Docs and small formatting

* Add description of capping to all edge geom docs
@thomasp85
Copy link
Owner

I think your use case has been fixed with #35 and using the label_rect helper?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants