Browse Source

minor theme tweaks

master
boB Rudis 3 years ago
parent
commit
643816d3a0
No known key found for this signature in database GPG Key ID: 1D7529BE14E2BBA9
  1. 4
      DESCRIPTION
  2. 24
      R/finish-theme.R
  3. 3
      R/theme-gs.R
  4. 9
      R/theme-inter.R
  5. 3
      R/theme-rc.R
  6. 2
      man/preview_variant.Rd
  7. 3
      man/theme_gs.Rd
  8. 9
      man/theme_inter.Rd
  9. 3
      man/theme_rc.Rd

4
DESCRIPTION

@ -2,8 +2,8 @@ Package: hrbragg
Type: Package
Title: Typography-centric Themes, Theme Components, and Utilities
for 'ggplot2' and 'ragg'.
Version: 0.2.0
Date: 2021-02-16
Version: 0.2.1
Date: 2021-05-20
Authors@R: c(
person(
given = "Bob",

24
R/finish-theme.R

@ -21,6 +21,7 @@ finish_theme <- function(base_size,
axis_col,
grid,
axis,
axis_text = TRUE,
ticks,
base_family,
plot_title_family,
@ -85,7 +86,10 @@ finish_theme <- function(base_size,
}
} else {
ret <- ret + theme(panel.grid = element_blank())
ret +
theme(
panel.grid = element_blank()
) -> ret
}
if (inherits(axis, "character") | axis == TRUE) {
@ -134,6 +138,7 @@ finish_theme <- function(base_size,
xj <- switch(tolower(substr(axis_title_just, 1, 1)), b = 0, l = 0, m = 0.5, c = 0.5, r = 1, t = 1)
yj <- switch(tolower(substr(axis_title_just, 2, 2)), b = 0, l = 0, m = 0.5, c = 0.5, r = 1, t = 1)
if (axis_text) {
ret +
theme(
axis.text.x = element_text(size = axis_text_size, margin = margin(t = 0), lineheight = line_height),
@ -142,8 +147,23 @@ finish_theme <- function(base_size,
axis.text.y = element_text(size = axis_text_size, margin = margin(r = 0), lineheight = line_height),
axis.text.y.left = element_text(size = axis_text_size, margin = margin(r = 0), lineheight = line_height),
axis.text.y.right = element_text(size = axis_text_size, margin = margin(r = 0), lineheight = line_height),
axis.text.y.right = element_text(size = axis_text_size, margin = margin(r = 0), lineheight = line_height)
) -> ret
} else {
ret +
theme(
axis.text.x = element_blank(),
axis.text.x.top = element_blank(),
axis.text.x.bottom = element_blank(),
axis.text.y = element_blank(),
axis.text.y.left = element_blank(),
axis.text.y.right = element_blank(),
) -> ret
}
ret +
theme(
axis.title = element_text(
size = axis_title_size,
family = axis_title_family, lineheight = line_height

3
R/theme-gs.R

@ -30,6 +30,7 @@
#' @param grid grid
#' @param axis_col axis col
#' @param axis axis
#' @param axis_text axis text labels
#' @param ticks ticks
#' @return ggplot2 theme
#' @export
@ -77,6 +78,7 @@ theme_gs <- function(
axis_col = theme_foreground_color(mode, light = "#2b2b2b", dark = "#606367"),
grid = TRUE,
axis = FALSE,
axis_text = TRUE,
ticks = FALSE) {
base_family <- gsc_pkg$normal
@ -111,6 +113,7 @@ theme_gs <- function(
axis_col = axis_col,
grid = grid,
axis = axis,
axis_text = axis_text,
ticks = ticks,
base_family = base_family,
plot_title_family = plot_title_family,

9
R/theme-inter.R

@ -30,6 +30,7 @@
#' @param grid grid
#' @param axis_col axis col
#' @param axis axis
#' @param axis_text axis text labels
#' @param ticks ticks
#' @return ggplot2 theme
#' @export
@ -58,13 +59,13 @@ theme_inter <- function(
line_height = 0.875,
plot_title_size = 18,
plot_title_position = "panel",
plot_title_margin = 10,
plot_title_margin = 8,
subtitle_size = 12,
subtitle_margin = 12,
subtitle_margin = 10,
strip_text_size = 12,
strip_placement = "outer",
caption_size = 9,
caption_margin = 10,
caption_margin = 8,
axis_text_size = base_size,
axis_title_size = 9,
axis_title_just = "rt",
@ -77,6 +78,7 @@ theme_inter <- function(
axis_col = theme_foreground_color(mode, light = "#2b2b2b", dark = "#606367"),
grid = TRUE,
axis = FALSE,
axis_text = TRUE,
ticks = FALSE) {
base_family <- inter_pkg$normal
@ -111,6 +113,7 @@ theme_inter <- function(
axis_col = axis_col,
grid = grid,
axis = axis,
axis_text = axis_text,
ticks = ticks,
base_family = base_family,
plot_title_family = plot_title_family,

3
R/theme-rc.R

@ -30,6 +30,7 @@
#' @param grid grid
#' @param axis_col axis col
#' @param axis axis
#' @param axis_text axis text labels
#' @param ticks ticks
#' @return ggplot2 theme
#' @export
@ -77,6 +78,7 @@ theme_rc <- function(
axis_col = theme_foreground_color(mode, light = "#2b2b2b", dark = "#606367"),
grid = TRUE,
axis = FALSE,
axis_text = TRUE,
ticks = FALSE) {
base_family <- rc_pkg$normal
@ -111,6 +113,7 @@ theme_rc <- function(
axis_col = axis_col,
grid = grid,
axis = axis,
axis_text = axis_text,
ticks = ticks,
base_family = base_family,
plot_title_family = plot_title_family,

2
man/preview_variant.Rd

@ -8,7 +8,7 @@ preview_variant(
font_variant,
font_size = 5,
test_label = "Lorem Ipsum dolor sit amet consectetur. => A\\u20dd\\n−0+1:2~3,456789\\n−9+8:7~6,543210"
test_label = "Lorem Ipsum dolor sit amet consectetur. => A\\n−0+1:2~3,456789\\n−9+8:7~6,543210"
)
}
\arguments{

3
man/theme_gs.Rd

@ -28,6 +28,7 @@ theme_gs(
axis_col = theme_foreground_color(mode, light = "#2b2b2b", dark = "#606367"),
grid = TRUE,
axis = FALSE,
axis_text = TRUE,
ticks = FALSE
)
}
@ -72,6 +73,8 @@ theme_gs(
\item{axis}{axis}
\item{axis_text}{axis text labels}
\item{ticks}{ticks}
\item{text_geom_size}{text geom size}

9
man/theme_inter.Rd

@ -9,13 +9,13 @@ theme_inter(
line_height = 0.875,
plot_title_size = 18,
plot_title_position = "panel",
plot_title_margin = 10,
plot_title_margin = 8,
subtitle_size = 12,
subtitle_margin = 12,
subtitle_margin = 10,
strip_text_size = 12,
strip_placement = "outer",
caption_size = 9,
caption_margin = 10,
caption_margin = 8,
axis_text_size = base_size,
axis_title_size = 9,
axis_title_just = "rt",
@ -28,6 +28,7 @@ theme_inter(
axis_col = theme_foreground_color(mode, light = "#2b2b2b", dark = "#606367"),
grid = TRUE,
axis = FALSE,
axis_text = TRUE,
ticks = FALSE
)
}
@ -72,6 +73,8 @@ theme_inter(
\item{axis}{axis}
\item{axis_text}{axis text labels}
\item{ticks}{ticks}
\item{text_geom_size}{text geom size}

3
man/theme_rc.Rd

@ -28,6 +28,7 @@ theme_rc(
axis_col = theme_foreground_color(mode, light = "#2b2b2b", dark = "#606367"),
grid = TRUE,
axis = FALSE,
axis_text = TRUE,
ticks = FALSE
)
}
@ -72,6 +73,8 @@ theme_rc(
\item{axis}{axis}
\item{axis_text}{axis text labels}
\item{ticks}{ticks}
\item{text_geom_size}{text geom size}

Loading…
Cancel
Save