Skip to content

issue with add_annotations #1

@elfunesto

Description

@elfunesto

Thank your for your great package that fills an important gap. I noted that add_text_repel seems to interact and removes anything produced by add_annotations. For example, using your example


df <- data.frame(
  x    = c(1, 1.05, 1.02, 0.98, 1.5, 2.0),
  y    = c(2, 2.02, 2.05, 1.97, 2.5, 3.0),
  gene = c("TP53", "EGFR", "MYC", "PTEN", "BRCA1", "KRAS")
)

plot_ly(df, x = ~x, y = ~y, type = "scatter", mode = "markers") |>
#  add_text_repel(x = ~x, y = ~y, text = ~gene) |>
  add_annotations(x = 2, y = 3, text = "Example", showarrow = TRUE, arrowhead= 2,
                  ax =0, ay = 0, xref = "x", yref = "y", axref = "x", ayref = "y") 

produces a diagram with an arrow from (0,0) to (2,3), but the arrow disappeared when the add_text_repel is uncommented


df <- data.frame(
  x    = c(1, 1.05, 1.02, 0.98, 1.5, 2.0),
  y    = c(2, 2.02, 2.05, 1.97, 2.5, 3.0),
  gene = c("TP53", "EGFR", "MYC", "PTEN", "BRCA1", "KRAS")
)

plot_ly(df, x = ~x, y = ~y, type = "scatter", mode = "markers") |>
  add_text_repel(x = ~x, y = ~y, text = ~gene) |>
  add_annotations(x = 2, y = 3, text = "Example", showarrow = TRUE, arrowhead= 2,
                  ax =0, ay = 0, xref = "x", yref = "y", axref = "x", ayref = "y") 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions