Browse Source

textbox_simple and margin tweaks

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

4
DESCRIPTION

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

4
NEWS.md

@ -1,2 +1,6 @@
0.2.2
* title/subtitle/caption are now `ggtext::element_textbox_simple()`
* minor margin tweaks
0.1.0 0.1.0
* Initial release * Initial release

87
R/finish-theme.R

@ -166,43 +166,69 @@ finish_theme <- function(base_size,
theme( theme(
axis.title = element_text( axis.title = element_text(
size = axis_title_size, size = axis_title_size,
family = axis_title_family, lineheight = line_height family = axis_title_family,
lineheight = line_height,
margin = margin(t = axis_title_size/2)
), ),
axis.title.x = element_text( axis.title.x = element_text(
hjust = xj, size = axis_title_size, hjust = xj, size = axis_title_size,
family = axis_title_family, lineheight = line_height family = axis_title_family,
lineheight = line_height
), ),
axis.title.x.top = element_text( axis.title.x.top = element_text(
hjust = xj, size = axis_title_size, hjust = xj,
family = axis_title_family, lineheight = line_height size = axis_title_size,
family = axis_title_family, lineheight = line_height,
margin = margin(b = axis_title_size/2)
), ),
axis.title.x.bottom = element_text( axis.title.x.bottom = element_text(
hjust = xj, size = axis_title_size, hjust = xj,
family = axis_title_family, lineheight = line_height size = axis_title_size,
family = axis_title_family,
lineheight = line_height,
margin = margin(t = axis_title_size/2)
), ),
axis.title.y = element_text( axis.title.y = element_text(
hjust = yj, size = axis_title_size, hjust = yj,
family = axis_title_family, lineheight = line_height size = axis_title_size,
family = axis_title_family,
lineheight = line_height,
margin = margin(r = axis_title_size/2)
), ),
axis.title.y.left = element_text( axis.title.y.left = element_text(
hjust = yj, size = axis_title_size, hjust = yj,
family = axis_title_family, lineheight = line_height size = axis_title_size,
family = axis_title_family,
lineheight = line_height,
margin = margin(r = axis_title_size/2)
), ),
axis.title.y.right = element_text( axis.title.y.right = element_text(
hjust = yj, size = axis_title_size, angle = 90, hjust = yj,
family = axis_title_family, lineheight = line_height size = axis_title_size,
angle = 90,
family = axis_title_family,
lineheight = line_height,
margin = margin(l = axis_title_size/2)
), ),
strip.placement = strip_placement, strip.placement = strip_placement,
strip.text = element_text( strip.text = element_text(
hjust = 0, size = strip_text_size, color = foreground_colour, hjust = 0,
family = strip_text_family, lineheight = line_height size = strip_text_size,
color = foreground_colour,
family = strip_text_family,
lineheight = line_height,
margin = margin(b = strip_text_size/2)
), ),
strip.text.x = element_text( strip.text.x = element_text(
hjust = 0, size = strip_text_size, color = foreground_colour, hjust = 0,
family = strip_text_family, lineheight = line_height size = strip_text_size,
color = foreground_colour,
family = strip_text_family,
lineheight = line_height,
margin = margin(b = strip_text_size/2)
), ),
strip.background = element_rect( strip.background = element_rect(
fill = background_colour, color = NA fill = background_colour, color = NA
@ -214,25 +240,36 @@ finish_theme <- function(base_size,
fill = background_colour, color = NA fill = background_colour, color = NA
), ),
strip.text.y = element_text( strip.text.y = element_text(
hjust = 0, size = strip_text_size, color = foreground_colour, hjust = 0,
family = strip_text_family, lineheight = line_height size = strip_text_size,
color = foreground_colour,
family = strip_text_family,
lineheight = line_height,
margin = margin(l = strip_text_size/2)
), ),
panel.spacing = panel_spacing, panel.spacing = panel_spacing,
panel.background = element_rect(color = NA, fill = background_colour), panel.background = element_rect(color = NA, fill = background_colour),
plot.background = element_rect(color = NA, fill = background_colour), plot.background = element_rect(color = NA, fill = background_colour),
plot.title.position = plot_title_position, plot.title.position = plot_title_position,
plot.margin = plot_margin, plot.margin = plot_margin,
plot.title = element_text( plot.title = ggtext::element_textbox_simple(
hjust = 0, size = plot_title_size, margin = margin(b = plot_title_margin), hjust = 0, size = plot_title_size,
margin = margin(b = plot_title_margin),
family = plot_title_family, lineheight = line_height family = plot_title_family, lineheight = line_height
), ),
plot.subtitle = element_text( plot.subtitle = ggtext::element_textbox_simple(
hjust = 0, size = subtitle_size, margin = margin(b = subtitle_margin), hjust = 0, size = subtitle_size,
margin = margin(b = subtitle_margin),
family = subtitle_family, lineheight = line_height family = subtitle_family, lineheight = line_height
), ),
plot.caption = element_text( plot.caption = ggtext::element_textbox(
hjust = 1, size = caption_size, margin = margin(t = caption_margin), hjust = 1,
family = caption_family, lineheight = line_height size = caption_size,
margin = margin(t = caption_margin),
family = caption_family,
lineheight = line_height
), ),
) -> ret ) -> ret

2
R/theme-gs.R

@ -65,7 +65,7 @@ theme_gs <- function(
strip_text_size = 12, strip_text_size = 12,
strip_placement = "outer", strip_placement = "outer",
caption_size = 10, caption_size = 10,
caption_margin = 10, caption_margin = 12,
axis_text_size = base_size, axis_text_size = base_size,
axis_title_size = 10, axis_title_size = 10,
axis_title_just = "rt", axis_title_just = "rt",

2
R/theme-inter.R

@ -65,7 +65,7 @@ theme_inter <- function(
strip_text_size = 12, strip_text_size = 12,
strip_placement = "outer", strip_placement = "outer",
caption_size = 9, caption_size = 9,
caption_margin = 8, caption_margin = 11,
axis_text_size = base_size, axis_text_size = base_size,
axis_title_size = 9, axis_title_size = 9,
axis_title_just = "rt", axis_title_just = "rt",

2
R/theme-rc.R

@ -65,7 +65,7 @@ theme_rc <- function(
strip_text_size = 12, strip_text_size = 12,
strip_placement = "outer", strip_placement = "outer",
caption_size = 9, caption_size = 9,
caption_margin = 10, caption_margin = 12,
axis_text_size = base_size, axis_text_size = base_size,
axis_title_size = 9, axis_title_size = 9,
axis_title_just = "rt", axis_title_just = "rt",

4
README.md

@ -7,7 +7,9 @@ by](https://img.shields.io/badge/Keybase-Verified-brightgreen.svg)](https://keyb
![Signed commit ![Signed commit
%](https://img.shields.io/badge/Signed_Commits-100%25-lightgrey.svg) %](https://img.shields.io/badge/Signed_Commits-100%25-lightgrey.svg)
[![Linux build [![Linux build
Status](https://travis-ci.org/hrbrmstr/hrbragg.svg?branch=master)](https://travis-ci.org/hrbrmstr/hrbragg) Status](https://travis-ci.org/hrbrmstr/hrbragg.svg?branch=master)](https://travis-ci.org/hrbrmstr/hrbragg)
[![Coverage
Status](https://codecov.io/gh/hrbrmstr/hrbragg/branch/master/graph/badge.svg)](https://codecov.io/gh/hrbrmstr/hrbragg)
![Minimal R ![Minimal R
Version](https://img.shields.io/badge/R%3E%3D-3.6.0-blue.svg) Version](https://img.shields.io/badge/R%3E%3D-3.6.0-blue.svg)
![License](https://img.shields.io/badge/License-MIT-blue.svg) ![License](https://img.shields.io/badge/License-MIT-blue.svg)

2
man/theme_gs.Rd

@ -15,7 +15,7 @@ theme_gs(
strip_text_size = 12, strip_text_size = 12,
strip_placement = "outer", strip_placement = "outer",
caption_size = 10, caption_size = 10,
caption_margin = 10, caption_margin = 12,
axis_text_size = base_size, axis_text_size = base_size,
axis_title_size = 10, axis_title_size = 10,
axis_title_just = "rt", axis_title_just = "rt",

2
man/theme_inter.Rd

@ -15,7 +15,7 @@ theme_inter(
strip_text_size = 12, strip_text_size = 12,
strip_placement = "outer", strip_placement = "outer",
caption_size = 9, caption_size = 9,
caption_margin = 8, caption_margin = 11,
axis_text_size = base_size, axis_text_size = base_size,
axis_title_size = 9, axis_title_size = 9,
axis_title_just = "rt", axis_title_just = "rt",

2
man/theme_rc.Rd

@ -15,7 +15,7 @@ theme_rc(
strip_text_size = 12, strip_text_size = 12,
strip_placement = "outer", strip_placement = "outer",
caption_size = 9, caption_size = 9,
caption_margin = 10, caption_margin = 12,
axis_text_size = base_size, axis_text_size = base_size,
axis_title_size = 9, axis_title_size = 9,
axis_title_just = "rt", axis_title_just = "rt",

Loading…
Cancel
Save