R语言

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

2022-07-18  本文已影响0人  SnorkelingFan凡潜
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

上一篇 下一篇

猜你喜欢

热点阅读