dev.off() prints not usefull messages like "null device 1" when finishing. This supresses these messages.
30 lines
744 B
R
30 lines
744 B
R
# secMalASCT utilities
|
|
#
|
|
# License: GPL version 3
|
|
# Jens Mathis Sauer (c) 2020
|
|
|
|
#
|
|
# Write plot to filename
|
|
#
|
|
# This will plot "fun" with arguments "..." as filetype "ftype" and
|
|
# the output to "filename". Title and legends can be passed as list,
|
|
# or NULL if not needed.
|
|
# Default filesize is 3000x3000 px and 300 dpi resolution.
|
|
#
|
|
sma_plot_file <- function(fname, ftype, title_list, legend_list, fun, ...) {
|
|
# Open file for writing
|
|
ftype(filename = fname, width = 3000, height = 3000, res = 300)
|
|
|
|
# run "fun" with passed arguments
|
|
do.call(fun, list(...))
|
|
|
|
if (!is.null(title_list)) {
|
|
do.call(title, title_list)
|
|
}
|
|
if(!is.null(legend_list)) {
|
|
do.call(legend, legend_list)
|
|
}
|
|
# hide "null device 1" in garbage
|
|
garbage <- dev.off()
|
|
}
|