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

geom_textsegment() #44

Merged
merged 11 commits into from
Dec 21, 2021
Merged

geom_textsegment() #44

merged 11 commits into from
Dec 21, 2021

Conversation

teunbrand
Copy link
Collaborator

@teunbrand teunbrand commented Dec 21, 2021

Hi Alan,

This PR adds the geom_textsegment() and geom_labelsegment() functions, the former originally mentioned in #5 (comment). Due them typically being straight, straight = TRUE is the default for Cartesian coordinates.

In addition, it adds the rd_dots() function to put in #' @eval rd_dots(funname) roxygen documentation. The intended use is for children of GeomTextpath and GeomLabelpath, so we can omit all the static text parameters from the function formals and in the params of the constructor. These typically go through ... and rd_dots() should figure out which ones are in the formals and which get passed through .... Ultimately, this makes it slightly less verbose in our code to include these parameters.

library(ggplot2)
#> Warning: package 'ggplot2' was built under R version 4.1.1
library(geomtextpath)

sleep2 <- reshape(sleep, direction = "wide",
                  idvar = "ID", timevar = "group")

ggplot(sleep2, aes(x = "Drug 1", y = extra.1)) +
  geom_textsegment(
    aes(xend = "Drug 2", yend = extra.2,
        label = paste0("Patient #", ID)),
  )

Created on 2021-12-21 by the reprex package (v2.0.1)

@AllanCameron AllanCameron merged commit 5c3a568 into AllanCameron:main Dec 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants