When I try to save a plot made using ggplot as a pdf using this code:
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
)
I get the following error:
Error in grDevices::pdf(..., version = version) :
cannot open file 'file.pdf'
Calls: ggsave -> device ->
Execution halted