Browse Source

minor theme tweaks

master
boB Rudis 5 months ago
parent
commit
643816d3a0
No known key found for this signature in database GPG Key ID: 1D7529BE14E2BBA9
9 changed files with 56 additions and 18 deletions
  1. +2
    -2
      DESCRIPTION
  2. +29
    -9
      R/finish-theme.R
  3. +3
    -0
      R/theme-gs.R
  4. +6
    -3
      R/theme-inter.R
  5. +3
    -0
      R/theme-rc.R
  6. +1
    -1
      man/preview_variant.Rd
  7. +3
    -0
      man/theme_gs.Rd
  8. +6
    -3
      man/theme_inter.Rd
  9. +3
    -0
      man/theme_rc.Rd

+ 2
- 2
DESCRIPTION View File

@ -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",


+ 29
- 9
R/finish-theme.R View File

@ -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,16 +138,32 @@ 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)
ret +
theme(
axis.text.x = element_text(size = axis_text_size, margin = margin(t = 0), lineheight = line_height),
axis.text.x.top = element_text(size = axis_text_size, margin = margin(t = 0), lineheight = line_height),
axis.text.x.bottom = element_text(size = axis_text_size, margin = margin(t = 0), lineheight = line_height),
if (axis_text) {
ret +
theme(
axis.text.x = element_text(size = axis_text_size, margin = margin(t = 0), lineheight = line_height),
axis.text.x.top = element_text(size = axis_text_size, margin = margin(t = 0), lineheight = line_height),
axis.text.x.bottom = element_text(size = axis_text_size, margin = margin(t = 0), lineheight = line_height),
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)
) -> 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_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 = 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
- 0
R/theme-gs.R View File

@ -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,


+ 6
- 3
R/theme-inter.R View File

@ -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
- 0
R/theme-rc.R View File

@ -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,


+ 1
- 1
man/preview_variant.Rd View File

@ -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
- 0
man/theme_gs.Rd View File

@ -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}


+ 6
- 3
man/theme_inter.Rd View File

@ -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
- 0
man/theme_rc.Rd View File

@ -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