Skip to content

Error in ggforce::geom_link2() #60

Description

@RenaLYY

Hi,
Thanks a lot for developing the powerful dynverse series software. But I come across an issue in plotting, could you please help me to fix it.

This is the code that I used and the error message that I receive:

library(tidyverse)
library(dyno)

get trajectory

data(example_bifurcating)
trajectory <- example_bifurcating %>% add_root()

gather some prior information

grouping <- trajectory$prior_information$groups_id
groups <- tibble(
group_id = trajectory$milestone_ids,
color = dynplot:::milestone_palette_list$auto(length(group_id))
)
features_oi <- apply(as.matrix(trajectory$counts), 2, sd) %>% sort() %>% names() %>% tail(10)
feature_oi <- features_oi[[10]]

patchwork::wrap_plots(
plot_dimred(trajectory) + labs(title = "Topology"),
plot_dimred(trajectory, "milestone") + labs(title = "Ordering"),
plot_dimred(trajectory, grouping=grouping, groups=groups) + labs(title = "Grouping/clustering"),
plot_dimred(trajectory, feature_oi=feature_oi) + labs(title = "Expression of\na single gene"),
plot_dimred(trajectory, "pseudotime") + labs(title = "Pseudotime"),
byrow = TRUE,
ncol = 3
) & theme(legend.position = "none")

Coloring by milestone
Using milestone_percentages from trajectory
Using milestone_percentages from trajectory
Coloring by grouping
Coloring by expression
Pseudotime not provided, will calculate pseudotime from root milestone
Error in ggforce::geom_link2():
! Problem while converting geom to grob.
ℹ Error occurred in the 7th layer.
Caused by error in [.data.frame:
! undefined columns selected
Run rlang::last_error() to see where the error occurred.

rlang::last_error()
<error/rlang_error>
Error in ggforce::geom_link2():
! Problem while converting geom to grob.
ℹ Error occurred in the 7th layer.
Caused by error in [.data.frame:
! undefined columns selected

Backtrace:

  1. base (local) <fn>(x)
  2. patchwork:::print.patchwork(x)
  3. patchwork:::build_patchwork(plot, plot$layout$guides %||% "auto")
  4. base::lapply(x$plots, plot_table, guides = guides)
  5. patchwork:::plot_table.ggplot(X[[i]], ...)
  6. ggplot2::ggplotGrob(x)
  7. ggplot2:::ggplot_gtable.ggplot_built(ggplot_build(x))
  8. ggplot2:::by_layer(...)
  9. ggplot2 (local) f(l = layers[[i]], d = data[[i]])
  10. l$draw_geom(d, layout)
  11. ggplot2 (local) draw_geom(..., self = self)
  12. self$geom$draw_layer(...)
  13. ggplot2 (local) draw_layer(..., self = self)
  14. base::lapply(...)
  15. ggplot2 (local) FUN(X[[i]], ...)
  16. self$draw_panel(...)
  17. ggforce (local) draw_panel(...)
  18. ggforce:::dapply(...)
  19. base::lapply(...)
  20. ggforce (local) FUN(X[[i]], ...)
  21. ggforce (local) fun(cur_data, ...)
  22. base::[.data.frame(df, , c("alpha", "colour", "size", "linetype"))
  23. base::stop("undefined columns selected")
    Run rlang::last_trace() to see the full context.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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