hrbrpkghelpr::global_opts()
knitr::opts_chunk$set(
  dev = "ragg_png",
  cache = TRUE
)
hrbrpkghelpr::stinking_badges()
hrbrpkghelpr::yank_title_and_description()

What's Inside The Tin

The following functions are implemented:

hrbrpkghelpr::describe_ingredients()

Installation

hrbrpkghelpr::install_block()

Usage

library(tibble)
library(hrbragg)
library(ggplot2)

# current version
packageVersion("hrbragg")

For the moment, you'll need to install Inter:

install_inter()

Inspect the definitions of the feature codes:

str(inter_pkg, 1)

data("feature_dict")

feature_dict[feature_dict$tag %in% textshaping::get_font_features("Inter")[[1]],]

Let's make a plot!

ggplot() +
  geom_point(
    data = mtcars,
    aes(mpg, wt, color = factor(cyl))
  ) +
  geom_label(
    aes(
      x = 15, y = 5.48,
      label = "<- A fairly useless annotation\n       that uses the custom Inter\n          variant by default."
    ),
    label.size = 0, hjust = 0, vjust = 1
  ) +
  labs(
    x = "Fuel efficiency (mpg)", y = "Weight (tons)",
    title = "Seminal ggplot2 scatterplot example",
    subtitle = "A plot that is only useful for demonstration purposes",
    caption = "Brought to you by the letter 'g'"
  ) -> gg1

Dark & light mode support with just a parameter change!

gg1 + theme_inter(grid = "XY", mode = "dark") 

Note the ligatures aren't as nice in Goldman Sans

gg1 + theme_rc(grid = "XY", mode = "dark") 

Note the ligatures aren't as nice in or Roboto Condensed

gg1 + theme_gs(grid = "XY", mode = "dark") 
gg1 + theme_inter(grid = "XY", mode = "light") 
gg1 + theme_rc(grid = "XY", mode = "light") 
gg1 + theme_gs(grid = "XY", mode = "light") 

Making sure we got all the various plot components styled

ggplot() +
  geom_point(
    data = mpg,
    aes(displ, hwy, color = trans)
  ) +
  facet_wrap(
    vars(cyl, drv), scales = "free", drop = TRUE
  ) +
  labs(
    x = "Displacement", y = "Highway",
    title = "Another seminal ggplot2 scatterplot example",
    subtitle = "A plot that is only useful for demonstration purposes",
    caption = "Brought to you by the letter 'g'"
  ) -> gg2
gg2 + theme_inter(grid = "XY", mode = "light") 
gg2 + theme_inter(grid = "XY", mode = "dark") 

Here's a way to preview any variants you create:

preview_variant(inter_pkg)
reconfigure_font(
  family = "Trattatello",
  width = "normal",
  ligatures = "discretionary",
  calt = 1, tnum = 1, case = 1,
  dlig = 1, kern = 1,
  zero = 0, salt = 0
) -> trat

preview_variant(trat)
reconfigure_font(
  family = "Barlow",
  width = "normal",
  ligatures = "standard",
  tnum = 1, kern = 1
) -> barlow

preview_variant(barlow)

hrbragg Metrics

cloc::cloc_pkg_md()

Code of Conduct

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.



hrbrmstr/hrbragg documentation built on Feb. 3, 2022, 1:39 a.m.