CellChat icon indicating copy to clipboard operation
CellChat copied to clipboard

Error in netVisual_circle(prob.i, sources.use = sources.use, targets.use = targets.use, : The input `color.use` should be a named vector!

Open 1JYL123 opened this issue 1 year ago • 4 comments

Thanks for your useful tool. However, when I use netVisual_individual, I have a problem. This is my code. color_use <- c('#E41A1C','#377EB8','#00CCCC','#984EA3','#FF7F00','#FFCC33','#A65628','#F781BF','#999999','#A6CEE3','#9999CC','#666633','#33A02C','#FB9A99', "#CC33FF", "#FF3366") netVisual_individual(cell_chat_all_cell, signaling = "PD-L1", pairLR.use = "CD274_PDCD1", layout = "circle", color.use = color_use)

Error in netVisual_circle(prob.i, sources.use = sources.use, targets.use = targets.use, : The input color.use should be a named vector!

Traceback:

  1. netVisual_individual(cell_chat_all_cell, signaling = "PD-L1", . pairLR.use = "CD274_PDCD1", layout = "circle", color.use = color_use)
  2. netVisual_circle(prob.i, sources.use = sources.use, targets.use = targets.use, . remove.isolate = remove.isolate, top = top, color.use = color.use, . vertex.weight = vertex.weight, vertex.weight.max = vertex.weight.max, . vertex.size.max = vertex.size.max, weight.scale = weight.scale, . edge.weight.max = edge.weight.max, edge.width.max = edge.width.max, . title.name = signalName_i, vertex.label.cex = vertex.label.cex, . ...)
  3. stop("The input color.use should be a named vector! \n")

when I set layout = "chord", it can normally run.

1JYL123 avatar Aug 27 '24 08:08 1JYL123

When I use the netVisual_circle() in V2.0.0, It is ok. I think this problem is a bug. 1856352460

1JYL123 avatar Aug 27 '24 08:08 1JYL123

Were you able to resolve this? I am having a similar issue with netAnalysis_signalingRole_network which outputted the error: 'elements in 'col' should be named vectors. A named vector was used for color.use parameter in a similar manner to other visualisation functions (e.g netVisual_chord_gene (where it worked fine) but here in the instance of the netAnalysis_signalingRole_network function, it did not work.

RLau0 avatar Oct 22 '24 13:10 RLau0

Were you able to resolve this? I am having a similar issue with netAnalysis_signalingRole_network which outputted the error: 'elements in 'col' should be named vectors. A named vector was used for color.use parameter in a similar manner to other visualisation functions (e.g netVisual_chord_gene (where it worked fine) but here in the instance of the netAnalysis_signalingRole_network function, it did not work.

I have used the 2.0.0 of CellChat to solve this problem.

1JYL123 avatar Oct 23 '24 01:10 1JYL123

I am getting this error with version 2.1.2 of cellchat for heatmap-related plots, including netAnalysis_signalingRole_network() and netVisual_heatmap(). Has this bug been addressed?

paularstrpo avatar Jan 21 '25 19:01 paularstrpo

I am getting the same error with CellChat version 2.2.0. I have stored my colors in a named vector and used the this vector in netVisual_diffInteraction without any issues, but when I give the same vector to netVisual_heatmap, I am getting Error: elements in col should be named vectors. Is there any update concerning this?

mesposit avatar Dec 15 '25 11:12 mesposit