CellChat icon indicating copy to clipboard operation
CellChat copied to clipboard

netVisual_chord_cell - netVisual_individual - par(mfrow) and title.name do not display

Open JensFGG opened this issue 2 years ago • 4 comments


When using the netVisual_Chord_cell the par(mfrow, c(2,1)) and title.name function do not work.

par(mfrow = c(2,1))

netVisual_chord_cell(cellchatF7Ctrl, sources.use = group.new[i], signaling = "GRN", slot.name = "net", show.legend = TRUE, scale = F, nCol = 2, lab.cex = 2, small.gap = 5, title.name = paste0(pathways.show[1]))

netVisual_chord_cell(cellchatF7, sources.use = group.new[i], signaling = "GRN", slot.name = "net", show.legend = TRUE, scale = F, nCol = 2, lab.cex = 2, small.gap = 5, title.name = paste0(pathways.show[1]))

I'm using markdown and this code plots 2 times 2 plots (2 times the first and two times the second)

JensFGG avatar Jan 17 '23 11:01 JensFGG

Hello,

I'm having a similar issue for the functions "netVisual_circle" and "netVisual_aggregate". The title is blank. I was wondering if you found a solution for this?

Thank you, Jessica

JessicaChevallier avatar Mar 08 '23 15:03 JessicaChevallier

@JessicaChevallier You may explicitly add text(0,1.5,title.name, cex = 1.1) after running this function.

sqjin avatar Mar 09 '23 15:03 sqjin

Hello,

Thank you, but, that does not seem to work for me. I used the following after running the function to add a title.

title("title you want")

Thanks! Jessica

JessicaChevallier avatar Mar 17 '23 14:03 JessicaChevallier

Hi all

This might help.

https://github.com/sqjin/CellChat/issues/670#issuecomment-1710193590

When netVisual_circle builds the plot object, title.name was appended after plot() event has happened. When actually showing the figure, plotting is clipped to the plot region (default is par(xpd = FALSE)), hence title is clipped out.

We need to explicitly set par(xpd = TRUE) so that plotting is clipped to the figure region (i.e. that also includes title).

par(xpd = TRUE)
netVisual_circle(cellchat@net$count, vertex.weight = groupSize, weight.scale = TRUE, label.edge = FALSE, 
                 title.name = "Number of interactions")

ycl6 avatar Sep 07 '23 14:09 ycl6