Search code examples
rplotr-corrplot

Saving a correlation matrix graphic as PDF


I have an correlation matrix object I created with corrplot

p1 <- corrplot(correlations_history, method = "number", type = "lower", title = "Regional Factor Correlation Matrix over history", mar = c(0,0,1,0), number.cex = 0.5, number.digits = 2)

I'm trying to save it as a pdf. For some reason I can't figure out how to do that. Any help appreciated. Thank you!


Solution

  • Start the pdf graphics driver then call your plot.

    pdf(file = "yourfilename.pdf")
    
    corrplot(correlations_history, method = "number", type = "lower", 
    title = "Regional Factor Correlation Matrix over history", 
    mar = c(0,0,1,0), number.cex = 0.5, number.digits = 2)
    
    dev.off()