CellChat icon indicating copy to clipboard operation
CellChat copied to clipboard

Error in visualizing chord diagram

Open jojob123 opened this issue 4 years ago • 13 comments

Hi, I'm getting errors when trying to plot the chord diagram in "Inference and analysis of cell-cell communication": par(mfrow=c(1,1)) netVisual_aggregate(cellchat, signaling = pathways.show, layout = "chord") #> Note: The first link end is drawn out of sector 'Inflam. FIB'.

It gives the error: Error: not enough space for cells at track index '2'

I tried: "netVisual_aggregate(cellchat, signaling = pathways.show, layout = "chord", labels_track_height = 0.1)", but it also didn't work.

Is there a way to solve this? Thanks

jojob123 avatar Jun 28 '21 12:06 jojob123

@jojob123 You can reduce the parameter values of small.gap and big.gap. If still does not work, you can use netVisual_chord_cell and netVisual_chord_gene to control these parameters.

sqjin avatar Jun 30 '21 17:06 sqjin

@sqjin I reduced the values, but now it says: Error: not enough space for bottom margin of cells at track index '2'.

Could you clarify what you mean by using netVisual_chord_cell and netVisual_chord_gene to control these parameters?

Thanks for the reply.

jojob123 avatar Jul 01 '21 06:07 jojob123

I received the same error (not enough space for cells at track index '1' in my case) when running CellChat in an R Notebook in RStudio. I was able to fix it by adding figure dimensions to the header of my code chunk (i.e. {r fig.height=5,fig.width=5} rather than just {r} after the three backticks).

retropc66 avatar Aug 27 '21 15:08 retropc66

@sqjin I am also receiving the same error. I can plot when I make the figure size very big, but then the area covered by the actual chord plot is very small. Depicted below is the minimum plotting size I can get where it doesn't give me the error.

Some advice to get this working would be great appreciated :)

cellchat_GRN_TNFRSF1A_chord

BradBalderson avatar Sep 20 '21 05:09 BradBalderson

I am also receiving the same error.(Error: not enough space for cells at track index '1'.) Is there a way to solve this? thaks!

xutongran avatar Dec 14 '21 07:12 xutongran

This error can be fixed by preseting canvas size. for instance

pdf(file ="cellchat.pdf", width = 20, height =16)
netVisual_aggregate()
dev.off()

Hope this can help you

gogozyz avatar Dec 23 '21 15:12 gogozyz

I have same issue with netVisual_aggregate(object.list[[i]], signaling = pathways.show, layout = "chord", signaling.name = paste(pathways.show, names(object.list)[i])) }

and get this error:Error: not enough space for cells at track index '1'.

Please share any solution if you have found. Thanks.

reza2026131 avatar Jan 06 '22 06:01 reza2026131

@reza2026131 You can reduce the parameter values of small.gap and big.gap. This is the way I have done before

sqjin avatar Jan 08 '22 16:01 sqjin

Changing the values of the small.gap did not work for me!

reza2026131 avatar Jan 09 '22 06:01 reza2026131

if you are using PDF paste and the image is tiny, check what you have in par(mfrow=c(X,Y)). That line defines how many images should fit on the paper, even when there is only 1 picture. So (mfrow=c(4,6)) would always try to fit 4 rows and 6 columns of your pictures on the paper, while (mfrow=c(1,1)) will use all the paper to draw only 1 picutre.

VaiskiVemmel avatar Jun 12 '23 07:06 VaiskiVemmel

try dev.off(), then plot

hanguojun007 avatar Jun 29 '23 10:06 hanguojun007

It works: pathways.show <- c("CXCL") pdf(file ="cellchat.pdf", width = 20, height =16)

p<-netVisual_aggregate(cellchat, signaling = pathways.show, layout = "chord") print(p) dev.off()

DmdCalvinChen avatar Dec 01 '23 03:12 DmdCalvinChen

This error can be fixed by preseting canvas size. for instance可以通过预设画布大小来修复此错误。例如

pdf(file ="cellchat.pdf", width = 20, height =16)
netVisual_aggregate()
dev.off()

Hope this can help you希望这能帮到你 thank you,dude

DmdCalvinChen avatar Dec 01 '23 03:12 DmdCalvinChen