I try to suppress the Saving 7 x 7 in image
output of ggsave()
whenever I run it, but it seems impossible. Is this possible? How to do it?
I have tried the following, but nothing works:
capture.output()
sink()
Minimal ``working'' example:
librrary(ggplot2)
df <- data.frame(gp = factor(rep(letters[1:3], each = 10)),
y = rnorm(30))
plot.to.be.saved <- ggplot(df) + geom_point(aes(x = gp, y = y))
sink('/dev/null')
ggsave(filename = '~/.so.pdf', plot = plot.to.be.saved)
sink()
# Saving 7 x 7 in image
options(warn=-1)
no.output.please <- ggsave(filename = '~/.so.pdf', plot = plot.to.be.saved)
# Saving 7 x 7 in image
capture.output(ggsave(filename = '~/.so.pdf', plot = plot.to.be.saved), file = 'NUL')
# Saving 7 x 7 in image
ggplot2:::plot_dim
issues this as a message, so suppressMessages(ggsave("test.pdf", ggplot()))
should do.
If you get a message like:
Saving 6.45 x 7.47 in image
ggsave()
is telling you how large it rendered the image because no size values were specified.
Add the following to ggsave()
to prevent this message:
width=w, height=h
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