geomtextpath
geomtextpath copied to clipboard
Support for `geom_step()`?
Thanks for the package. Any chance of adding a geom_textstep()
to work with geom_step()
please?
Thanks for the interest. I'm not sure how well text paths work on steps, though it might be convenient to add this in the next update. In the meantime it's simple enough to make a geom_step
equivalent using geom_textpath
with minor data wrangling:
library(geomtextpath)
#> Loading required package: ggplot2
#> Warning: package 'ggplot2' was built under R version 4.1.3
set.seed(1)
df <- data.frame(x = 1:10, y = sample(1:10))
ggplot(df, aes(x, y)) +
geom_step()
ggplot(data = with(df, data.frame(x = c(rep(x, each = 2), c(x[length(x)])),
y = c(y[1], rep(y, each = 2)))
)) +
geom_textpath(aes(x = x, y = y, label = 'This works as a stop gap'))
Created on 2023-09-12 with reprex v2.0.2
Thanks, and yes the appearance would depend on the label length and the number of steps, but it works for my use case.