Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hrbrmstr/hrbragg
Typography-centric Themes, Theme Components, and Utilities for 'ggplot2' and 'ragg'.
https://github.com/hrbrmstr/hrbragg
ggplot2 r ragg rstats typography
Last synced: 6 days ago
JSON representation
Typography-centric Themes, Theme Components, and Utilities for 'ggplot2' and 'ragg'.
- Host: GitHub
- URL: https://github.com/hrbrmstr/hrbragg
- Owner: hrbrmstr
- License: other
- Created: 2021-02-16T06:09:01.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-02-01T14:33:38.000Z (almost 3 years ago)
- Last Synced: 2024-10-12T21:24:02.591Z (22 days ago)
- Topics: ggplot2, r, ragg, rstats, typography
- Language: R
- Homepage:
- Size: 6.06 MB
- Stars: 40
- Watchers: 7
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
README
---
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
) -> tratpreview_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
) -> barlowpreview_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.