小编Kas*_*ton的帖子

R错误保存ggplot pdf

当我尝试使用此代码保存使用ggplot作为pdf制作的绘图时:

library(ggplot2)

file = "/data/mda/20150630-1Mb-full_comparison-low_depth_hTERT/result/comparison_figure/SD_rank_custom.csv"
figure_file = "/data/mda/20150604-1Mb-full_comparison-low_depth_hTERT/result/comparison_figure/SD_rank_custom.pdf"

sd_data <- as.data.frame(read.csv(file, header=TRUE))

# generate box plot
ggplot(
    data=sd_data,
    aes(
        x=Experiment, 
        y=SD
    )
)+  
theme_bw() + #use bw theme
geom_boxplot(outlier.shape = NA) + #hide outlier points
geom_jitter() + 
theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))   

ggsave(
  filename=figure_file,
  width=10,
  height=10
)
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

grDevices :: pdf(...,version = version)中的错误:

无法打开文件'file.pdf'

调用:ggsave - > device - >

执行停止

我认为我的R版本最近更新为3.2.0,我已经确认它在v3.1.1中工作正常,所以我假设这与版本有关.我还确认我可以将csv文件写入目录.

任何想法如何解决这一问题?

pdf r ggplot2

5
推荐指数
1
解决办法
5738
查看次数

标签 统计

ggplot2 ×1

pdf ×1

r ×1