diff --git a/geau/DESCRIPTION b/geau/DESCRIPTION index a0062160655e736d1ad4c7dacb636d37c590ee14..41acb3151d26699aa5415f7f7a8c295d719d93a1 100644 --- a/geau/DESCRIPTION +++ b/geau/DESCRIPTION @@ -1,6 +1,6 @@ Package: geau Title: Utilities very useful to share within geau-inondation team -Version: 1.0.12.0 +Version: 1.0.13.0 Authors@R: c( person(given = "Frédéric", diff --git a/geau/R/map_so_ii.r b/geau/R/map_so_ii.r index 6ed4265d6220233c0252bfa182fe7c805857f3ca..b86b5c9103042e490a8c05f1444a679c243f7bd9 100644 --- a/geau/R/map_so_ii.r +++ b/geau/R/map_so_ii.r @@ -60,7 +60,17 @@ #' years is plotted.} #' } #' } -#' +#' \subsection{path specification}{ +#' Depending on the extension a device is chosen. +#' \itemize{ +#' \item{\strong{pdf}: grDevices::cairo_pdf} +#' \item{\strong{png}: grDevices::png} +#' \item{\strong{svg}: grDevices::svg} +#' } +#' If path is NULL, standard plotting is used. If an extension is not managed, +#' an error is raised. +#' } +#' #' @param dataset sf objectf, data to be plotted #' @param dataset_legend list of parameters to be passed to legend #' @param theme character, choice for the theme (if any). See details. @@ -68,7 +78,8 @@ #' @param detail character, detail for theme, depends on theme. See details. #' @param year character, the year chosen for some themes. See details. #' @param bar logical, should a bar be plotted for the dataset -#' @param path character, the name of the file to save the plot +#' @param path character, the name of the file to save the plot. Graphical +#' device is chosen depending on extension. See details. #' @param ... some parameters that will be used by plot (from sf) #' #' @return Nothing useful. @@ -101,8 +112,9 @@ map_so_ii = function( if (!is.null(path)) { switch( EXPR = tolower(tools::file_ext(path)), - "pdf" = grDevices::pdf(path), + "pdf" = grDevices::cairo_pdf(path), "png" = grDevices::png(path), + "svg" = grDevices::svg(path), stop(sprintf("%s not recognized", tolower(tools::file_ext(path)))) ) on.exit(grDevices::dev.off()) diff --git a/geau/man/map_so_ii.Rd b/geau/man/map_so_ii.Rd index 8c7cb6de278f496250db3452ebe61e8dbde59568..2dc0259884e2f37619b6fb7d6467a9ba592ba723 100644 --- a/geau/man/map_so_ii.Rd +++ b/geau/man/map_so_ii.Rd @@ -33,7 +33,8 @@ map_so_ii( \item{bar}{logical, should a bar be plotted for the dataset} -\item{path}{character, the name of the file to save the plot} +\item{path}{character, the name of the file to save the plot. Graphical +device is chosen depending on extension. See details.} \item{...}{some parameters that will be used by plot (from sf)} } @@ -103,6 +104,16 @@ provided an analysis of the evolution between the range of given years is plotted.} } } +\subsection{path specification}{ +Depending on the extension a device is chosen. +\itemize{ +\item{\strong{pdf}: grDevices::cairo_pdf} +\item{\strong{png}: grDevices::png} +\item{\strong{svg}: grDevices::svg} +} +If path is NULL, standard plotting is used. If an extension is not managed, +an error is raised. +} } \examples{