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

Error in ggforce::geom_link2() #60

Open
RenaLYY opened this issue Feb 2, 2023 · 0 comments
Open

Error in ggforce::geom_link2() #60

RenaLYY opened this issue Feb 2, 2023 · 0 comments

Comments

@RenaLYY
Copy link

RenaLYY commented Feb 2, 2023

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.
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