tryCatch({
pdf(paste0(dir,"/Pathway-bubble-",pathways.show,'-',ct_name, ".pdf"))
netVisual_bubble(cellchat, sources.use = ct,signaling = pathways.show,remove.isolate = F) %>% print()
dev.off()
}, error = function(e) {
dev.off()
cat("Error")
})
兩個(gè)踩的坑:
- 必須得加
%>% print()
才能打印圖到pdf - 如果報(bào)錯(cuò)鸵赫,必須得加
dev.off()
關(guān)閉圖形設(shè)備琳水,否則后面的圖會(huì)全部畫(huà)不出來(lái)