I've read this and this but cannot make it work.
vDF <- data.frame(v = rnorm(50,1,40))
g <- ggplot(vDF, aes(x = vDF)) + geom_histogram()
ggsave(g, file="name.eps")
I keep getting the error
Error in grDevices::postscript(..., onefile = FALSE, horizontal = FALSE, : cannot open file 'name.eps'
Why can't I make this work? I've see advice saying 'hey just do...
setEPS()
postscript("whatever.eps")
plot(rnorm(100), main="Hey Some Data")
dev.off()
But I can't even save the original .eps file in the first place.
First, there's an error in your code. It should be:
vDF <- data.frame(v = rnorm(50,1,40))
g <- ggplot(vDF, aes(x = v)) + geom_histogram()
(note the aes).
Now, to save the plot as eps, you have to use the option device=eps in ggsave:
ggsave(g, file="name.eps", device="eps")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With