Hello,
I am encountering an issue with the "Graphics API version mismatch" error when using the DESeq2 package in RStudio on Ubuntu 22.04. The error occurs when attempting to save plots using ggplot2 (ggsave) within DESeq2 functions like plotPCA. I have thoroughly investigated this issue, including checking package versions, graphics drivers, and system settings, but I have not been able to find a resolution.
Environment:
R version: 4.3.1 (2023-06-16) RStudio version: 2023.09.1 Ubuntu version: 22.04 Loaded Packages:
DESeq2 (v1.42.0) apeglm DEGreport tibble stringr readxl dplyr ggplot2 (v3.4.4) SummarizedExperiment Biobase MatrixGenerics matrixStats GenomicRanges GenomeInfoDb IRanges S4Vectors BiocGenerics
Interestingly, I found a reference example (link provided) that uses the same packages and functions, but it works without any issues.
Reference Example: https://alexslemonade.github.io/refinebio-examples/03-rnaseq/dimension-reduction_rnaseq_01_pca.html
My code so far:
dds <- DESeqDataSetFromMatrix(countData = mycounts, colData = coldata, design = ~condition + timepoint + condition:timepoint)
dds <- DESeq(dds)
vsdata <- vst(dds, blind=FALSE)
z <- plotPCA(vsdata, intgroup = "condition")
z + ggtitle("my title") + theme(plot.title = element_text(hjust = 0.5))
ggsave(path = "mypath/", filename = "PCA", device = 'png', dpi=300)
Output: Error in f(...) : Graphics API version mismatch
Thank you for your help.
Would you mind making a minimal reproducible example and post it here? You cannot really expect people to first go through a long document to dig out the sparsely described problem you see.
I added the code. Hope this helps more!