It would be helpful to have the capability of passing a vector of shapes to geom_edge_span instead of a single element. This functionality was available in a previous version (2.0.5), I recall.
library(ggraph)
#> Loading required package: ggplot2
graph <- tidygraph::create_notable('zachary')
# single end_shape works fine
ggraph(graph, 'fabric', sort.by = node_rank_fabric()) +
geom_node_range(colour = 'grey') +
geom_edge_span(end_shape = 'square') +
coord_fixed()
# multiple shapes cause an error
ggraph(graph, 'fabric', sort.by = node_rank_fabric()) +
geom_node_range(colour = 'grey') +
geom_edge_span(end_shape = c('square', 'circle', 'cross')) +
coord_fixed()
#> Error in `geom_edge_span()`:
#> ! Problem while converting geom to grob.
#> ℹ Error occurred in the 2nd layer.
#> Caused by error in `if (is.na(end_shape)) ...`:
#> ! the condition has length > 1
The right graph was created by modifying R/geom_edge.R to support conditions longer than 1:
# line 318
if (is.na(end_shape)) return(panel)
if (all(is.na(end_shape))) return(panel)
Hi,
It would be helpful to have the capability of passing a vector of shapes to
geom_edge_span
instead of a single element. This functionality was available in a previous version (2.0.5), I recall.The right graph was created by modifying R/geom_edge.R to support conditions longer than 1:
Created on 2024-05-20 with reprex v2.1.0