Skip to content

Commit

Permalink
Modify theme
Browse files Browse the repository at this point in the history
  • Loading branch information
dieghernan committed Nov 15, 2022
1 parent 063233d commit 84ef5aa
Show file tree
Hide file tree
Showing 12 changed files with 67 additions and 43 deletions.
3 changes: 3 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@ export(scale_color_bde_d)
export(scale_fill_bde_c)
export(scale_fill_bde_d)
export(theme_tidybde)
importFrom(ggplot2,"%+replace%")
importFrom(ggplot2,element_blank)
importFrom(ggplot2,element_line)
importFrom(ggplot2,element_rect)
importFrom(ggplot2,element_text)
importFrom(ggplot2,margin)
importFrom(ggplot2,rel)
importFrom(ggplot2,unit)
importFrom(utils,download.file)
importFrom(utils,read.csv2)
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

- New parameter `out_format` on `bde_series_load()`.

- Use best practices and small adjustments on `theme_tidybde()`.

# tidyBdE 0.3.0

- Overall improvements on downloading files:
Expand Down
68 changes: 41 additions & 27 deletions R/theme_tidybde.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@
#'
#' @export
#'
#' @return A [ggplot2::theme()].
#' @return A [ggplot2::theme_classic()].
#'
#' @param ... Ignored.
#' @inheritDotParams ggplot2::theme_classic
#'
#' @seealso [ggplot2::theme()]
#' @seealso [ggplot2::theme_classic()]
#'
#' @details
#'
#' Theme based on [ggplot2::theme_classic()].
#'
#' @importFrom ggplot2 %+replace% rel margin
#' @examplesIf bde_check_access()
#' \donttest{
#' library(tidyverse)
Expand All @@ -31,7 +36,7 @@
#' names(series_TC_pivot) <- c("x", "y")
#'
#' ggplot(series_TC_pivot, aes(x = x, y = y)) +
#' geom_line(size = 0.8, color = bde_vivid_pal()(1)) +
#' geom_line(linewidth = 0.8, color = bde_vivid_pal()(1)) +
#' labs(
#' title = "Title",
#' subtitle = "Some metric",
Expand All @@ -43,48 +48,57 @@
#'
theme_tidybde <- function(...) {
# nocov start
ggplot2::theme_classic() +
ggplot2::theme_classic(...) %+replace%
ggplot2::theme(
plot.background = element_rect(fill = NA),
plot.margin = unit(rep(10, 4), "pt"),
panel.background = element_rect(fill = NA),
line = element_line(linewidth = rel(0.5)),
plot.background = element_rect(fill = "white", colour = NA),
plot.margin = unit(rep(5.5, 4) * 3, "pt"),
plot.title = element_text(
margin = margin(b = 4),
hjust = 0, vjust = 1,
size = rel(1.1)
),
plot.subtitle = element_text(
hjust = 0, vjust = 1,
size = rel(0.9),
margin = margin(t = 4, b = 4)
),
plot.caption = element_text(
hjust = 1, vjust = 0,
size = rel(.75)
),
panel.background = element_rect(fill = "white", colour = NA),
panel.grid.major.y = element_line(
colour = "grey70",
linetype = "dashed"
),
axis.title = element_blank(),
axis.ticks.length = unit(-3, "pt"),
axis.ticks.length = unit(-2.75, "pt"),
axis.text.x.bottom = element_text(
size = 8,
margin = unit(c(10, 5, 0, 5), "pt")
margin = margin(t = 7.5, b = 5, unit = "pt"),
size = rel(.9)
),
axis.text.x.top = element_text(
size = 8,
margin = unit(c(0, 5, 10, 5), "pt")
margin = margin(b = 7.5, t = 5, unit = "pt"),
size = rel(.9)
),
axis.text.y.left = element_text(
size = 8,
margin = unit(c(5, 10, 5, 0), "pt")
hjust = 1,
margin = margin(r = 7.5, l = 5, unit = "pt"),
size = rel(.9)
),
axis.text.y.right = element_text(
size = 8,
margin = unit(c(5, 0, 5, 10), "pt")
hjust = 0,
margin = margin(l = 7.5, r = 5, unit = "pt"),
size = rel(.9)
),
legend.position = "bottom",
legend.justification = c(0, 0),
legend.title.align = 0,
legend.title = element_blank(),
legend.key = element_blank(),
legend.key.width = unit(25, "pt"),
legend.text = element_text(size = 9),
plot.title = element_text(size = 12, margin = unit(c(rep(
5, 4
)), "pt")),
plot.subtitle = element_text(size = 8, margin = unit(c(rep(
5, 4
)), "pt")),
plot.caption = element_text(size = 8, margin = unit(c(rep(
8, 4
)), "pt"))
legend.text = element_text(size = rel(0.9))
)
# nocov end
}
2 changes: 1 addition & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ knitr::opts_chunk$set(
[![rOS-badge](https://ropenspain.github.io/rostemplate/reference/figures/ropenspain-badge.svg)](https://ropenspain.es/)
[![CRAN-status](https://www.r-pkg.org/badges/version/tidyBdE)](https://CRAN.R-project.org/package=tidyBdE)
[![CRAN-results](https://cranchecks.info/badges/worst/tidyBdE)](https://cran.r-project.org/web/checks/check_results_tidyBdE.html)
[![Downloads](http://cranlogs.r-pkg.org/badges/grand-total/tidyBdE?color=blue)](https://cran.r-project.org/package=tidyBdE)
[![Downloads](https://cranlogs.r-pkg.org/badges/grand-total/tidyBdE?color=blue)](https://cran.r-project.org/package=tidyBdE)
[![On-CRAN](https://www.r-pkg.org/badges/ago/tidyBdE)](https://cran.r-project.org/web/checks/check_results_tidyBdE.html)
[![r-universe](https://ropenspain.r-universe.dev/badges/tidyBdE)](https://ropenspain.r-universe.dev/)
[![R-CMD-check](https://github.com/rOpenSpain/tidyBdE/actions/workflows/check-full.yaml/badge.svg)](https://github.com/rOpenSpain/tidyBdE/actions/workflows/check-full.yaml)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[![rOS-badge](https://ropenspain.github.io/rostemplate/reference/figures/ropenspain-badge.svg)](https://ropenspain.es/)
[![CRAN-status](https://www.r-pkg.org/badges/version/tidyBdE)](https://CRAN.R-project.org/package=tidyBdE)
[![CRAN-results](https://cranchecks.info/badges/worst/tidyBdE)](https://cran.r-project.org/web/checks/check_results_tidyBdE.html)
[![Downloads](http://cranlogs.r-pkg.org/badges/grand-total/tidyBdE?color=blue)](https://cran.r-project.org/package=tidyBdE)
[![Downloads](https://cranlogs.r-pkg.org/badges/grand-total/tidyBdE?color=blue)](https://cran.r-project.org/package=tidyBdE)
[![On-CRAN](https://www.r-pkg.org/badges/ago/tidyBdE)](https://cran.r-project.org/web/checks/check_results_tidyBdE.html)
[![r-universe](https://ropenspain.r-universe.dev/badges/tidyBdE)](https://ropenspain.r-universe.dev/)
[![R-CMD-check](https://github.com/rOpenSpain/tidyBdE/actions/workflows/check-full.yaml/badge.svg)](https://github.com/rOpenSpain/tidyBdE/actions/workflows/check-full.yaml)
Expand Down
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@
},
"applicationCategory": "Macroeconomics",
"isPartOf": "https://ropenspain.es/",
"fileSize": "783.071KB",
"fileSize": "775.473KB",
"citation": [
{
"@type": "SoftwareSourceCode",
Expand Down
13 changes: 4 additions & 9 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,30 @@ BdE
CMD
CatastRo
Catastro
DESCRIPCIÓN
DOI
DTCCBCEGBPEUR
Datos
Descripcion
Económicos
España
Euribor
Eurostat
FRECUENCIA
GBP
Geográfico
Herrero
IGN
INE
Indicadores
Instituto
LABORABLE
MMM
MMMMYYYY
MicroDatosEs
NOMBRE
Nacional
Numero
NÚMERO
ORCID
Precompile
SECUENCIAL
SERIE
SSM
Sede
Tipo
UNIDADES
YYYY
bde
cambio
Expand All @@ -48,6 +39,7 @@ diarios
doi
electrónica
esterlinas
fiel
geospatial
github
halfyear
Expand All @@ -57,10 +49,13 @@ io
mapSpain
microdata
por
pts
rOS
rect
ropenspain
secuencial
serie
tibble
tidyBdE’
tidyr
zenodo
Binary file modified man/figures/README-chart-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/README-macroseries-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 14 additions & 4 deletions man/theme_tidybde.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified vignettes/chart-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified vignettes/macroseries-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 84ef5aa

Please sign in to comment.