美文网首页R语言
R画图并保存(pdf/jpg/png等)

R画图并保存(pdf/jpg/png等)

作者: SnorkelingFan凡潜 | 来源:发表于2022-07-18 17:13 被阅读0次
  • 以PDF为例
library(ggplot2)

# Opening the graphical device
# Customizing the output
pdf("p1umap.pdf",         # File name
    width = 8, height = 7, # Width and height in inches
    bg = "transparent",          # Background color
    colormodel = "cmyk"    # Color model (cmyk is required for most publications)
    paper = "A4")          # Paper size

# Creating a plot
p1 <- DimPlot(w15_1_2_st.obj.rds, reduction = "umap")

# Closing the graphical device
dev.off()

svg/png/jpg以此类推,改名称即可

参考:https://r-coder.com/save-plot-r/#:~:text=First%2C%20in%20order%20to%20save%20a%20plot%20as,plot%20plot%28rnorm%2820%29%29%20%23%20Closing%20the%20graphical%20device%20dev.off%28%29

相关文章

网友评论

    本文标题:R画图并保存(pdf/jpg/png等)

    本文链接:https://www.haomeiwen.com/subject/roddirtx.html