CellChat icon indicating copy to clipboard operation
CellChat copied to clipboard

Error with netVisual_aggregate in spatial data

Open yuiko-chan opened this issue 1 year ago • 1 comments

Hi ,

Thank you for the nice package.

I have problems when I use the following code in cellchatV2, since V2 cannot ask questions, I can only ask this question here, which I feel really sorry about.

There is the question netVisual_aggregate(cellchat, signaling = pathways.show, layout = "spatial", edge.width.max = 2, vertex.size.max = 1, alpha.image = 0.2, vertex.label.cex = 3.5)

Error in geom_point(): ! Problem while setting up geom aesthetics. ℹ Error occurred in the 3rd layer. Caused by error in check_aesthetics(): ! Aesthetics must be either length 1 or the same as the data (1073). ✖ Fix the following mappings: colour. Run rlang::last_trace() to see where the error occurred. Backtrace: ▆

  1. ├─base (local) <fn>(x)
  2. └─ggplot2:::print.ggplot(x)
  3. ├─ggplot2::ggplot_build(x)
  4. └─ggplot2:::ggplot_build.ggplot(x)
  5. └─ggplot2:::by_layer(...)
    
  6.   ├─rlang::try_fetch(...)
    
  7.   │ ├─base::tryCatch(...)
    
  8.   │ │ └─base (local) tryCatchList(expr, classes, parentenv, handlers)
    
  9.   │ │   └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
    
  10.   │ │     └─base (local) doTryCatch(return(expr), name, parentenv, handler)
    
  11.   │ └─base::withCallingHandlers(...)
    
  12.   └─ggplot2 (local) f(l = layers[[i]], d = data[[i]])
    
  13.     └─l$compute_geom_2(d)
    
  14.       └─ggplot2 (local) compute_geom_2(..., self = self)
    
  15.         └─self$geom$use_defaults(data, self$aes_params, modifiers)
    
  16.           └─ggplot2 (local) use_defaults(..., self = self)
    
  17.             └─ggplot2:::check_aesthetics(new_params, nrow(data))
    

I don't have this problem when using other data.The error here should be ggplot2, but I don't know where to set the color, and I don't know how to modify this error.

Do you have any thoughts on this?

Thank you so much in advance.

yuiko-chan avatar Oct 21 '24 18:10 yuiko-chan

Save problem. Error in geom_point(): ! Problem while setting up geom aesthetics. ℹ Error occurred in the 3rd layer. Caused by error in check_aesthetics(): ! Aesthetics must be either length 1 or the same as the data (3650). ✖ Fix the following mappings: colour. Run rlang::last_trace() to see where the error occurred.

monkeyBai96 avatar Jan 07 '25 07:01 monkeyBai96