You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
2 years ago | |
---|---|---|
R | 2 years ago | |
data | 2 years ago | |
data-raw | 2 years ago | |
inst | 2 years ago | |
man | 2 years ago | |
tests | 2 years ago | |
.Rbuildignore | 2 years ago | |
.codecov.yml | 2 years ago | |
.gitignore | 2 years ago | |
.travis.yml | 2 years ago | |
CONDUCT.md | 2 years ago | |
DESCRIPTION | 2 years ago | |
LICENSE | 2 years ago | |
LICENSE.md | 2 years ago | |
NAMESPACE | 2 years ago | |
NEWS.md | 2 years ago | |
README.Rmd | 2 years ago | |
README.md | 2 years ago | |
hrbragg.Rproj | 2 years ago |
README.md
hrbragg
Typography-centric Themes, Theme Components, and Utilities for ‘ggplot2’ and ‘ragg’.
Description
The ‘ragg’, ‘systemfonts’, and ‘textshaping’ packages make it possible to create plot components and themes that make full use of the rich typography features in modern fonts. Fonts, themes, and utilities are provided to create ‘ggplot2’ plots intended for rendering on ‘ragg’ graphics devices.
What’s Inside The Tin
The following functions are implemented:
adaptive_color
: Adaptive colors colors for hrbragg themeselb
: Shortcut for element_blankell
: Shortcut for element_lineelr
: Shortcut for element_rectelt
: Shortcut for element_textfeature_dict
: OpenType feature description lookup tableinstall_inter
: Install Interinter_pkg
: Inter Font Variantopentype_typographic_features
: OpenType Typographic Featuresreconfigure_font
: Create an complete, alternate font family with the same customized featurestheme_inter
: ggplot2 Theme Based On The Inter Font Family
Installation
remotes::install_git("https://git.rud.is/hrbrmstr/hrbragg.git")
# or
remotes::install_gitlab("hrbrmstr/hrbragg")
# or
remotes::install_bitbucket("hrbrmstr/hrbragg")
NOTE: To use the ‘remotes’ install options you will need to have the {remotes} package installed.
Usage
library(hrbragg)
library(ggplot2)
# current version
packageVersion("hrbragg")
## [1] '0.1.0'
For the moment, you’ll need to install Inter:
install_inter()
str(inter_pkg, 1)
## List of 16
## $ ultralight : chr "hrbragg-pkg Inter Thin"
## $ ultralight_italic: chr "hrbragg-pkg Inter Thin Italic"
## $ light : chr "hrbragg-pkg Inter Extra Light"
## $ light_italic : chr "hrbragg-pkg Inter Extra Light Italic"
## $ normal_italic : chr "hrbragg-pkg Inter Light Italic"
## $ normal : chr "hrbragg-pkg Inter Light"
## $ medium_italic : chr "hrbragg-pkg Inter Medium Italic"
## $ medium : chr "hrbragg-pkg Inter Medium"
## $ semibold_italic : chr "hrbragg-pkg Inter Semi Bold Italic"
## $ semibold : chr "hrbragg-pkg Inter Semi Bold"
## $ bold : chr "hrbragg-pkg Inter Bold"
## $ bold_italic : chr "hrbragg-pkg Inter Bold Italic"
## $ ultrabold : chr "hrbragg-pkg Inter Extra Bold"
## $ ultrabold_italic : chr "hrbragg-pkg Inter Extra Bold Italic"
## $ heavy : chr "hrbragg-pkg Inter Black"
## $ heavy_italic : chr "hrbragg-pkg Inter Black Italic"
## - attr(*, "family")= chr "Inter"
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
gg1 + theme_inter(grid = "XY", mode = "dark")
gg1 + theme_inter(grid = "XY", mode = "light")
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")
hrbragg Metrics
Lang | # Files | (%) | LoC | (%) | Blank lines | (%) | # Lines | (%) |
---|---|---|---|---|---|---|---|---|
R | 13 | 0.46 | 332 | 0.43 | 89 | 0.39 | 646 | 0.47 |
Rmd | 1 | 0.04 | 50 | 0.07 | 26 | 0.11 | 46 | 0.03 |
SUM | 14 | 0.50 | 382 | 0.50 | 115 | 0.50 | 692 | 0.50 |
clock Package Metrics for hrbragg
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.