CellChat icon indicating copy to clipboard operation
CellChat copied to clipboard

A problem when using netVisual_aggregate

Open chuiqin opened this issue 5 years ago • 13 comments

Hi, Thanks for developing this user-friendly tool. I have problem when I run the code follow:

netVisual_aggregate(cellchat, signaling = pathways.show, vertex.receiver = c(1,2,3,5), vertex.size = groupSize)

I get this picuture follow:

Snipaste_2020-08-12_11-04-47

when I try to save it in local,I get this error and picuture follow:

Error in text.default(x, y, labels = labels, col = label.color, family = label.family, : invalid font type

Snipaste_2020-08-12_11-36-01

It seems that some problems are related with igraph.

Can you kindly help me with this problem? Thank you very much!

chuiqin avatar Aug 12 '20 03:08 chuiqin

@chuiqin Try install.packages("extrafont")

sqjin avatar Aug 12 '20 07:08 sqjin

Thank you very much for your help!

chuiqin avatar Aug 12 '20 08:08 chuiqin

@chuiqin Try install.packages("extrafont") I'm sorry but I still get the same error after installing packages("extrafont").

Error in text.default(x, y, labels = labels, col = label.color, family = label.family, : invalid font type

Can you help me with this problem again? Thank you!

chuiqin avatar Aug 12 '20 12:08 chuiqin

@chuiqin It looks like your R does not support 'Arial' font style when doing plotting. Can you google such issue based on your system of the computer as I did not hear of such issue from other users? The extrafont package is available here. In addition, please try save the plot using svglite(file ="a.pdf")...dev.off()

sqjin avatar Aug 12 '20 15:08 sqjin

@chuiqin It looks like your R does not support 'Arial' font style when doing plotting. Can you google such issue based on your system of the computer as I did not hear of such issue from other users? The extrafont package is available here. In addition, please try save the plot using svglite(file ="a.pdf")...dev.off()

Thank you very much! You're right! When I change my code: `library(svglite)

svglite(file = "pathway.svg", width=10, height=10)

netVisual_aggregate(cellchat, signaling = pathways.show, vertex.receiver = c(1,2,3,5), vertex.size = groupSize) dev.off()` It‘s surperised that the picture can created correctly! Thank you very much for your help again!

chuiqin avatar Aug 13 '20 08:08 chuiqin

Well, I got this error again .I have no idea about that how can I save the picture with the pdf format. who can help me ?

Portulaca666 avatar Sep 21 '20 02:09 Portulaca666

@wuzhigui Have you tried svglite(file ="a.pdf")...dev.off() or saving as .svg file?

sqjin avatar Sep 21 '20 03:09 sqjin

Hi, This error generally occurs when non-standard fonts like Arial or Times New Roman are not available in your R session. (This has been mentioned before https://github.com/sqjin/CellChat/issues/29#issuecomment-677048306) I was able to fix this as follows (Ubuntu):

  1. Download TTF files for font Arial and Times New Roman, e.g. from here.
  2. Unzip the files and put them into a reasonable directory, e.g. /home/USERNAME/fonts.
  3. Install the R extrafont package, and add the following code to the header of your script:
library(extrafont)
font_import(paths="/home/USERNAME/fonts", prompt=F)
loadfonts(device = "pdf", quiet = F)
  1. Run the code to generate PDF figures, for example:
pdf("/home/USERNAME/CellChat_results/network.pdf", width=7, height=7)
netVisual_aggregate(cellchat, signaling = pathways.show,  vertex.receiver = vertex.receiver, vertex.size = groupSize)
dev.off()

Worked like a charm for me. Cheers.

Xethic avatar Sep 24 '20 09:09 Xethic

Hi @Xethic , thank you so much for sharing this!

sqjin avatar Sep 24 '20 13:09 sqjin

I can't use netVisual_aggregate to get the graphics I want。I hope to get the following figure: 1645112229(1) However, I always get such a circle 1645112273(1)

Can you help me, thank you~

Aby-GGG avatar Feb 17 '22 15:02 Aby-GGG

@Aby-GGG You should set 'layout = "hierarchy"'.

sqjin avatar Feb 18 '22 11:02 sqjin

Thank you very much. This problem has been solved. But I can't draw a green ligand map with the following code.Can you help me, thank you~

cellchat <- netAnalysis_computeCentrality(cellchat,slot.name = "netP") # the slot 'netP' means the inferred intercellular communication network of signaling pathways pdf("5.pdf", width=6, height=6) netAnalysis_computeCentrality(cellchat, signaling = pathways.show, width = 12, height = 2.5, font.size = 10) dev.off()

cellchat <- netAnalysis_signalingRole(cellchat,slot.name = "netP") # the slot 'netP' means the inferred intercellular communication network of signaling pathways pdf("5.pdf", width=6, height=6) netAnalysis_signalingRole(cellchat, signaling = pathways.show, width = 12, height = 2.5, font.size = 10) dev.off()

------------------ 原始邮件 ------------------ 发件人: "sqjin/CellChat" @.>; 发送时间: 2022年2月18日(星期五) 晚上7:59 @.>; @.@.>; 主题: Re: [sqjin/CellChat] A problem when using netVisual_aggregate (#18)

@Aby-GGG You should set 'layout = "hierarchy"'.

— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you were mentioned.Message ID: @.***>

Aby-GGG avatar Feb 19 '22 05:02 Aby-GGG

This function can't draw a graph and always displays "could not find function" netAnalysis_signalingRole " "netAnalysis_computeCentrality " and "netAnalysis_signalingRole_network" can't figure out either。I want to get the following graphics

Can you help me, thank you~

Thank you very much. This problem has been solved. But I can't draw a green ligand map with the following code.Can you help me, thank you~

cellchat <- netAnalysis_computeCentrality(cellchat,slot.name = "netP") # the slot 'netP' means the inferred intercellular communication network of signaling pathways pdf("5.pdf", width=6, height=6) netAnalysis_computeCentrality(cellchat, signaling = pathways.show, width = 12, height = 2.5, font.size = 10) dev.off()

cellchat <- netAnalysis_signalingRole(cellchat,slot.name = "netP") # the slot 'netP' means the inferred intercellular communication network of signaling pathways pdf("5.pdf", width=6, height=6) netAnalysis_signalingRole(cellchat, signaling = pathways.show, width = 12, height = 2.5, font.size = 10) dev.off()

------------------ 原始邮件 ------------------ 发件人: "sqjin/CellChat" @.>; 发送时间: 2022年2月18日(星期五) 晚上7:59 @.>; @.@.>; 主题: Re: [sqjin/CellChat] A problem when using netVisual_aggregate (#18)

@Aby-GGG You should set 'layout = "hierarchy"'.

— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you were mentioned.Message ID: @.***>

Aby-GGG avatar Feb 19 '22 10:02 Aby-GGG