From 2f8299aa0ba1f7f2603a60e9f10d5ebe8d518399 Mon Sep 17 00:00:00 2001 From: pabsantos Date: Fri, 25 Aug 2023 17:01:36 -0300 Subject: [PATCH 1/4] Update (#7) --- R/theme_onsv.R | 16 +++++++++------- man/theme_onsv.Rd | 5 ++++- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/R/theme_onsv.R b/R/theme_onsv.R index 30d983e..da589a8 100644 --- a/R/theme_onsv.R +++ b/R/theme_onsv.R @@ -2,6 +2,8 @@ #' #' `theme_onsv()` is used to apply the ONSV theme to a ggplot graphics. #' +#' @param basesize A number to define font base size +#' #' @return A custom `theme()` object. #' @export #' @@ -11,7 +13,7 @@ #' ggplot(data = iris, aes(x = Sepal.Width, y = Sepal.Length)) + #' geom_point() + #' theme_onsv() -theme_onsv <- function() { +theme_onsv <- function(basesize = 10) { if (.Platform$OS.type == "windows") { font <- "sans" } else { @@ -21,14 +23,14 @@ theme_onsv <- function() { ggplot2::theme( plot.title = ggplot2::element_text( family = font, - size = 14, + size = basesize + 4, face = "bold", color = "grey10", margin = ggplot2::margin(t = 0, r = 0, b = 5, l = 0), ), plot.subtitle = ggplot2::element_text( family = font, - size = 12, + size = basesize + 2, margin = ggplot2::margin(t = 5, r = 0, b = 5, l = 0), color = "grey20" ), @@ -42,19 +44,19 @@ theme_onsv <- function() { legend.key = ggplot2::element_blank(), legend.text = ggplot2::element_text( family = font, - size = 10, + size = basesize, color = "grey20" ), legend.margin = ggplot2::margin(t = 0, r = 0, b = 0, l = -10), axis.title = ggplot2::element_text( family = font, - size = 10, + size = basesize, color = "grey10" ), axis.ticks = ggplot2::element_blank(), axis.text = ggplot2::element_text( family = font, - size = 9, + size = basesize - 1, color = "grey30" ), panel.grid.minor = ggplot2::element_blank(), @@ -68,6 +70,6 @@ theme_onsv <- function() { ), panel.background = ggplot2::element_rect(color = "white", fill = "white"), strip.background = ggplot2::element_rect(fill = "white"), - strip.text = ggplot2::element_text(size = 12, hjust = 0) + strip.text = ggplot2::element_text(size = basesize + 2, hjust = 0) ) } diff --git a/man/theme_onsv.Rd b/man/theme_onsv.Rd index adce8d7..fa2a2c4 100644 --- a/man/theme_onsv.Rd +++ b/man/theme_onsv.Rd @@ -4,7 +4,10 @@ \alias{theme_onsv} \title{Apply ONSV theme to ggplot object} \usage{ -theme_onsv() +theme_onsv(basesize = 10) +} +\arguments{ +\item{basesize}{A number to define font base size} } \value{ A custom \code{theme()} object. From 4e9bb5c6dd2c8f5ddf039a40632e8911aeaccdb0 Mon Sep 17 00:00:00 2001 From: pabsantos Date: Mon, 28 Aug 2023 11:21:39 -0300 Subject: [PATCH 2/4] Update NEWS --- NEWS.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 3a6d37c..933fba4 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,10 +1,13 @@ +# onsvplot 0.2.2 + +* Add new parameter to `theme_onsv()` (#7): Now it is possible to change `basesize` of the font used in the plot + # onsvplot 0.2.1 * Add two new parameters to `theme_onsv()` (#3): `plot.title.position = "plot"` and `plot.caption.position = "plot"`. * Add bottom margin to `title` element. - # onsvplot 0.2.0 * Updates the package name to `onsvplot`. The `obsplot` package already exists, therefore it was necessary to change the previous name. (#4) From 8e5a8a58a9693d98b6fc1e76595e7181ac6e4c94 Mon Sep 17 00:00:00 2001 From: pabsantos Date: Mon, 28 Aug 2023 11:21:56 -0300 Subject: [PATCH 3/4] Increment version number to 0.2.2 --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index b1ba669..11e6fae 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: onsvplot Title: Apply ONSV Style for Ggplot Graphics -Version: 0.2.1 +Version: 0.2.2 Authors@R: person( given = c("Pedro", "Augusto", "Borges"), From e2e1f61c463ba6e30ebe34abc6f4eeb918d565bf Mon Sep 17 00:00:00 2001 From: pabsantos Date: Mon, 28 Aug 2023 11:22:45 -0300 Subject: [PATCH 4/4] Update README --- README.Rmd | 2 +- README.md | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.Rmd b/README.Rmd index 3e4e14a..0005494 100644 --- a/README.Rmd +++ b/README.Rmd @@ -82,7 +82,7 @@ ggplot(data = iris, aes(x = Sepal.Length, y = Sepal.Width)) + ## Citation -If you want to cite this package, you can cite as : +If you want to cite this package, you can cite as: ```{r citation, echo=FALSE} citation("onsvplot") diff --git a/README.md b/README.md index 31a5b09..f456610 100644 --- a/README.md +++ b/README.md @@ -92,12 +92,12 @@ ggplot(data = iris, aes(x = Sepal.Length, y = Sepal.Width)) + ## Citation -If you want to cite this package, you can cite as : +If you want to cite this package, you can cite as: #> To cite package 'onsvplot' in publications use: #> #> Santos PAB (2023). _onsvplot: Apply ONSV Style for Ggplot Graphics_. - #> R package version 0.2.1, . + #> R package version 0.2.2, . #> #> A BibTeX entry for LaTeX users is #> @@ -105,6 +105,6 @@ If you want to cite this package, you can cite as : #> title = {onsvplot: Apply ONSV Style for Ggplot Graphics}, #> author = {Pedro Augusto Borges Santos}, #> year = {2023}, - #> note = {R package version 0.2.1}, + #> note = {R package version 0.2.2}, #> url = {https://www.github.com/pabsantos/onsvplot}, #> }