Closed jn-goe closed 3 years ago
It is expected. You need a ggplot object to save:
myplot = qplot(1) # it is actually ggplot
qqSave(myplot)
No error on my side, but broken for Julia. Unclear why.
Still unclear, title field for .PDF will be removed.
qqSave <- function(ggobj, ext =c("png", "pdf")[1], w =4, h = w
, page = c(F, "A4p", "A4l", "A5p", "A5l")[1]
, title = F, fname = F, ...) {
if (isFALSE(title)) title <- as.character(substitute(ggobj))
if (isFALSE(fname)) fname <- kpp(title, ext)
if (!isFALSE(page)) {
wA4 <- 8.27
hA4 <- 11.69
if ( page == "A4p" ) { w = wA4; h = hA4 }
if ( page == "A4l" ) { w = hA4; h = wA4 }
if ( page == "A5p" ) { w = wA4/2; h = hA4/2 }
if ( page == "A5l" ) { w = hA4/2; h = wA4/2 }
}
print(paste0(getwd(),"/", fname))
# ggsave(plot = ggobj, filename = fname)
# title <- if (ext == "pdf") ww.ttl_field(title) else NULL
cowplot::save_plot(plot = ggobj, filename = fname, base_width = w, base_height = h
, title =title
, ...)
}
Function
qqSave()
gives the errorhttps://github.com/vertesy/ggExpressDev/blob/87dc94cbe0260c7c525aca7198d263a10b4e98ba/ggExpress.functions.R#L96