enrichplot
enrichplot copied to clipboard
treeplot not working
Hello,
treeplot used to work fine for me (R v4.1) but now it is giving me this error. Could you help?
ERROR while rich displaying an object: Error in geom_segment2():
! Problem while converting geom to grob.
ℹ Error occurred in the 3rd layer.
Caused by error in check.length():
! 'gpar' element 'lwd' must not be length 0
Traceback:
- tryCatch(withCallingHandlers({ . if (!mime %in% names(repr::mime2repr)) . stop("No repr_* for mimetype ", mime, " in repr::mime2repr") . rpr <- repr::mime2repr[mime] . if (is.null(rpr)) . return(NULL) . prepare_content(is.raw(rpr), rpr) . }, error = error_handler), error = outer_handler)
- tryCatchList(expr, classes, parentenv, handlers)
- tryCatchOne(expr, names, parentenv, handlers[[1L]])
- doTryCatch(return(expr), name, parentenv, handler)
- withCallingHandlers({ . if (!mime %in% names(repr::mime2repr)) . stop("No repr_* for mimetype ", mime, " in repr::mime2repr") . rpr <- repr::mime2repr[mime] . if (is.null(rpr)) . return(NULL) . prepare_content(is.raw(rpr), rpr) . }, error = error_handler)
- repr::mime2repr[mime]
- repr_text.default(obj)
- paste(capture.output(print(obj)), collapse = "\n")
- capture.output(print(obj))
- withVisible(...elt(i))
- print(obj)
- print.ggplot(obj)
- ggplot_gtable(data)
- ggplot_gtable.ggplot_built(data)
- by_layer(function(l, d) l$draw_geom(d, layout), plot$layers, . data, "converting geom to grob")
- try_fetch(for (i in seq_along(data)) { . out[[i]] <- f(l = layers[[i]], d = data[[i]]) . }, error = function(cnd) { . cli::cli_abort(c("Problem while {step}.", i = "Error occurred in the {ordinal(i)} layer."), . call = layers[[i]]$constructor, parent = cnd) . })
- tryCatch(withCallingHandlers(expr, condition = function(cnd) { . { . .handler_frame. <- TRUE . .setup_frame. <- frame . if (inherits(cnd, "message")) { . except <- c("warning", "error") . } . else if (inherits(cnd, "warning")) { . except <- "error" . } . else { . except <- "" . } . } . while (!is_null(cnd)) { . if (inherits(cnd, "error")) { . out <- handlers[1L] . if (!inherits(out, "rlang_zap")) . throw(out) . } . inherit <- .subset2(.subset2(cnd, "rlang"), "inherit") . if (is_false(inherit)) { . return() . } . cnd <- .subset2(cnd, "parent") . } . }), stackOverflowError = handlers[[1L]])
- tryCatchList(expr, classes, parentenv, handlers)
- tryCatchOne(expr, names, parentenv, handlers[[1L]])
- doTryCatch(return(expr), name, parentenv, handler)
- withCallingHandlers(expr, condition = function(cnd) { . { . .handler_frame. <- TRUE . .setup_frame. <- frame . if (inherits(cnd, "message")) { . except <- c("warning", "error") . } . else if (inherits(cnd, "warning")) { . except <- "error" . } . else { . except <- "" . } . } . while (!is_null(cnd)) { . if (inherits(cnd, "error")) { . out <- handlers[1L] . if (!inherits(out, "rlang_zap")) . throw(out) . } . inherit <- .subset2(.subset2(cnd, "rlang"), "inherit") . if (is_false(inherit)) { . return() . } . cnd <- .subset2(cnd, "parent") . } . })
- f(l = layers[[i]], d = data[[i]])
- l$draw_geom(d, layout)
- draw_geom(..., self = self)
- self$geom$draw_layer(data, self$computed_geom_params, layout, . layout$coord)
- draw_layer(..., self = self)
- lapply(split(data, data$PANEL), function(data) { . if (empty(data)) . return(zeroGrob()) . panel_params <- layout$panel_params[[data$PANEL[1]]] . inject(self$draw_panel(data, panel_params, coord, !!!params)) . })
- FUN(X[[i]], ...)
- inject(self$draw_panel(data, panel_params, coord, !!!params))
- self$draw_panel(data, panel_params, coord, arrow = NULL, lineend = "butt", . na.rm = FALSE, nudge_x = 0.432898555929542)
- draw_panel(...)
- grid::segmentsGrob(data$x, data$y, data$xend, data$yend, default.units = "native", . gp = gpar(col = alpha(data$colour, data$alpha), fill = alpha(arrow.fill, . data$alpha), lwd = data$size * ggplot2::.pt, lty = data$linetype, . lineend = lineend, linejoin = linejoin), arrow = arrow)
- grob(x0 = x0, y0 = y0, x1 = x1, y1 = y1, arrow = arrow, name = name, . gp = gp, vp = vp, cl = "segments")
- gpar(col = alpha(data$colour, data$alpha), fill = alpha(arrow.fill, . data$alpha), lwd = data$size * ggplot2::.pt, lty = data$linetype, . lineend = lineend, linejoin = linejoin)
- validGP(list(...))
- numnotnull("lwd")
- check.length(gparname)
- stop(gettextf("'gpar' element '%s' must not be length 0", gparname), . domain = NA)
- .handleSimpleError(function (cnd) . { . { . .handler_frame. <- TRUE . .setup_frame. <- frame . if (inherits(cnd, "message")) { . except <- c("warning", "error") . } . else if (inherits(cnd, "warning")) { . except <- "error" . } . else { . except <- "" . } . } . while (!is_null(cnd)) { . if (inherits(cnd, "error")) { . out <- handlers[1L] . if (!inherits(out, "rlang_zap")) . throw(out) . } . inherit <- .subset2(.subset2(cnd, "rlang"), "inherit") . if (is_false(inherit)) { . return() . } . cnd <- .subset2(cnd, "parent") . } . }, "'gpar' element 'lwd' must not be length 0", base::quote(check.length(gparname)))
- h(simpleError(msg, call))
- handlers[1L]
- cli::cli_abort(c("Problem while {step}.", i = "Error occurred in the {ordinal(i)} layer."), . call = layers[[i]]$constructor, parent = cnd)
- rlang::abort(message, ..., call = call, use_cli_format = TRUE, . .frame = .frame)
- signal_abort(cnd, .file)