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

Manual vertical brackets do not work: "arguments imply differing number of rows" #115

Open
bersbersbers opened this issue Mar 5, 2022 · 1 comment

Comments

@bersbersbers
Copy link

I am trying to manually annotate a Kaplan-Meier-Plot with vertical significance brackets, and I am failing.

The reasons seems to be the orientation: the following horizontal example works fine, while the vertical does not print the brackets at all:

image

image

df <- data.frame(
  x = 1:4, y = c(1, 1, 1, 5)
)

df_signif <- data.frame(
  xmin = c(1, 3),
  xmax = c(3, 4),
  y_position = c(2, 6),
  annotations = c("NS", "***")
)

ggplot(df, aes(x = x, y = y)) +
  geom_point() +
  ggsignif::geom_signif(
    mapping = aes(
      xmin = xmin,
      xmax = xmax,
      y_position = y_position,
      annotations = annotations,
    ),
    data = df_signif,
    manual = TRUE,
  )

ggplot(df, aes(x = y, y = x)) + # note the reversed coordinates!
  geom_point() +
  ggsignif::geom_signif(
    mapping = aes(
      xmin = xmin,
      xmax = xmax,
      y_position = y_position,
      annotations = annotations,
    ),
    data = df_signif,
    manual = TRUE,
    orientation = "y", # note the orientation!
  )
@bersbersbers
Copy link
Author

Functionally related: kassambara/ggpubr#456

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

No branches or pull requests

1 participant