hrbrmstr / ggalt

:earth_americas: Extra Coordinate Systems, Geoms, Statistical Transformations & Scales for 'ggplot2'
https://cran.r-project.org/web/packages/ggalt/vignettes/ggalt_examples.html
Other
654 stars 99 forks source link

geom_dumbbell end point shape by group #81

Open kimblew opened 1 year ago

kimblew commented 1 year ago

Hi @hrbrmstr liking geom_dumbbell but have a case where I would like to have different shapes for the end point based upon a group

looking something similar to

df <- data.frame(sample = c('a','b'), from=c(1,2), to=c(4,3),outcome=as.factor(c('happy','sad'))) ggplot(df, aes(y=forcats::fct_reorder(sample,from,.desc=T),x=from,xend=to)) + geom_dumbbell() + labs(y=NULL)

geom_dumbbell(shape_xend = outcome)