Hello, I’m new to the scverse, and I’ve been doing my analysis primarily using R-based packages.
I’ve started branching out a bit to Python to be able to use scverse tools, and for ease of work, I wanted to group my analysis chunks in a R markdown. In conjugation with the {reticulate} package, I can have both R and python chunks in the same document, which is nice for interoperability.
To get started, I’ve been following the tutorial Scanpy in R (Scanpy in R). As in the tutorial, I saw that a lot of plots have the issue of being “shifted” to the right, which often cuts the legend. A similar issue is actually seen in the tutorial, but not addressed.
With these chunks
#R chunk
library("reticulate")
library("ggplot2")
library("SingleCellExperiment")
library("scater")
library("Seurat")
#Python chunk
import scanpy as sc
adata = sc.datasets.pbmc3k_processed()
adata
sc.pl.umap(adata, color='louvain')
(sorry, I cannot embed the image as a new user, but check out the tutorial at step 4.2 Using scanpy functions)
I also tried changing the knitr chunk options to expand plot, but it didn’t solve the issue
#Python chunk
#| fig.width: 10
#| fig.height: 5
sc.pl.umap(adata, color='louvain')
Do you have any idea how to solve this issue ? Any help would be greatly appreciated.