jinworks / CellChat

R toolkit for inference, visualization and analysis of cell-cell communication from single-cell and spatially resolved transcriptomics
GNU General Public License v3.0
215 stars 27 forks source link

Manipulate the direction of spatial plot #51

Open phoebee-h opened 6 months ago

phoebee-h commented 6 months ago

Hi, Thank you for providing this wonderful tool! (1) It has been working well for me as I followed the tutorial. However, I'm unsure about how to control the orientation of the spatial plot. I've stored the correct coordinates in the cellchat object, but when using netVisual_aggregate, the plot appears rotated unexpectedly. (2) Additionally, the title is absent in netVisual_aggregatewhen usinglayout = "circle", and the signal line might be covered by blank. Assigning the "signaling.name" parameter doesn't seem to change anything.

## The direction is correct in cellchat slot.
plot(cellchat@images$coordinates)

image

## It rotates unexpectedly.
netVisual_aggregate(cellchat, signaling = pathways.show, layout = "spatial", edge.width.max = 2, vertex.size.max = 1, alpha.image = 0.2, vertex.label.cex = 3.5)

image

## Title missing?
netVisual_aggregate(cellchat, signaling = pathways.show, layout = "circle", point.size = 2, 
signaling.name="IGF", vertex.label.cex = 1.5)

image

Thank you.

Best, Phoebe

sqjin commented 6 months ago

@phoebee-h For the orientation of the spatial plot, this issue should be fixed if you simply switch x_cent and y_cent in cellchat@images$coordinates.

For the issue you mentioned in the circle plot, I do notice this issue sometimes. Can you try to add par(mfrow=c(1,1)) before running this function.