You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
geom_path should support intermediate arrows #2280
If this geom supported intermediate arrows, it would be trivial to use ggplot2 to create connected scatterplots. It's currently possible--but cumbersome--to create connected scatterplots with geom_segment().
If folks agree that this change is worth making, I'm not sure if it would be cleaner to implement this by passing a vector of arrow objects to the geom's arrow argument, or through changes to the arrow function.
Reacted by Brian W. Davis, mikejacktzen and kdayri
I guess an intermediate solution would be if geom_path or geom_segment() or geom_curve() could return a set of discretized coordinates that was used to plot the curves
curve_id, x_1, y_1
that way the user can post process outside of ggplot2 to figure out which point in the set of coordinates they can use to add another geom layer
In this case, pluck out the mid point and then overlay a triangle or something
I dug around and see that geom_curve() uses grid::curveGrob()
but i can't quite figure out how curveGrob() returns the coordinate values
The big picture would be, once the curveGrob() coordinates are identified, the ggplot2 user could extract that from
p = ggplot() + geom_curve()
str(p)
p$geom_curve$coordinates
# whose values would be a data.frame looking like
# c(curve_id, x_1, y_1)
Activity
hadley commentedon Oct 30, 2017
This out of scope for ggplot2 since it would require a lot of work - it would be better to implement in an extension package instead.
mikejacktzen commentedon Dec 13, 2017
I came across this same feature wish while making network plots
https://mikejacktzen.wordpress.com/portfolio/be-a-bigballr-in-rstats/
I guess an intermediate solution would be if
geom_pathorgeom_segment()orgeom_curve()could return a set of discretized coordinates that was used to plot the curvesthat way the user can post process outside of ggplot2 to figure out which point in the set of coordinates they can use to add another geom layer
In this case, pluck out the mid point and then overlay a triangle or something
I dug around and see that
geom_curve()usesgrid::curveGrob()but i can't quite figure out how curveGrob() returns the coordinate values
The big picture would be, once the curveGrob() coordinates are identified, the ggplot2 user could extract that from
Then use it like