--- output: rmarkdown::github_document editor_options: chunk_output_type: console --- ```{r pkg-knitr-opts, include=FALSE} hrbrpkghelpr::global_opts() ``` ```{r ragg, echo = FALSE} knitr::opts_chunk$set( dev = "ragg_png", cache = TRUE ) ``` ```{r badges, results='asis', echo=FALSE, cache=FALSE} hrbrpkghelpr::stinking_badges() ``` ```{r description, results='asis', echo=FALSE, cache=FALSE} hrbrpkghelpr::yank_title_and_description() ``` ## What's Inside The Tin The following functions are implemented: ```{r ingredients, results='asis', echo=FALSE, cache=FALSE} hrbrpkghelpr::describe_ingredients() ``` ## Installation ```{r install-ex, results='asis', echo=FALSE, cache=FALSE} hrbrpkghelpr::install_block() ``` ## Usage ```{r lib-ex} library(tibble) library(hrbragg) library(ggplot2) # current version packageVersion("hrbragg") ``` For the moment, you'll need to install Inter: ```{r install-font, eval = FALSE} install_inter() ``` ### Inspect the definitions of the feature codes: ```{r ex-00} str(inter_pkg, 1) data("feature_dict") feature_dict[feature_dict$tag %in% textshaping::get_font_features("Inter")[[1]],] ``` ### Let's make a plot! ```{r ex-01} 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! ```{r dark-mode-01} gg1 + theme_inter(grid = "XY", mode = "dark") ``` Note the ligatures aren't as nice in Goldman Sans ```{r dark-mode-01-rc} gg1 + theme_rc(grid = "XY", mode = "dark") ``` ### Note the ligatures aren't as nice in or Roboto Condensed ```{r dark-mode-01-gs} gg1 + theme_gs(grid = "XY", mode = "dark") ``` ```{r light-mode-01} gg1 + theme_inter(grid = "XY", mode = "light") ``` ```{r light-mode-01-rc} gg1 + theme_rc(grid = "XY", mode = "light") ``` ```{r light-mode-01-gs} gg1 + theme_gs(grid = "XY", mode = "light") ``` ### Making sure we got all the various plot components styled ```{r ex-02} 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 ``` ```{r light-mode-02, fig.width=1400/96, fig.height=700/96} gg2 + theme_inter(grid = "XY", mode = "light") ``` ```{r dark-mode-02, fig.width=1400/96, fig.height=700/96} gg2 + theme_inter(grid = "XY", mode = "dark") ``` ### Here's a way to preview any variants you create: ```{r preview-00, fig.width=600/96, fig.height=1300/96} preview_variant(inter_pkg) ``` ```{r preview-01, fig.width=400/96, fig.height=300/96} 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) ``` ```{r preview-02, fig.width=600/96, fig.height=1100/96} reconfigure_font( family = "Barlow", width = "normal", ligatures = "standard", tnum = 1, kern = 1 ) -> barlow preview_variant(barlow) ``` ## hrbragg Metrics ```{r cloc, echo=FALSE} 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.