r-hrbrthemes
:lock_with_ink_pen: Opinionated, typographic-centric ggplot2 themes and theme components
Science Score: 49.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 3 DOI reference(s) in README -
✓Academic publication links
Links to: zenodo.org -
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (10.4%) to scientific vocabulary
Keywords
Keywords from Contributors
Repository
:lock_with_ink_pen: Opinionated, typographic-centric ggplot2 themes and theme components
Basic Info
Statistics
- Stars: 1,279
- Watchers: 23
- Forks: 95
- Open Issues: 32
- Releases: 5
Topics
Metadata Files
README.md
hrbrthemes
Additional Themes and Theme Components for ‘ggplot2’
This is a very focused package that provides typography-centric themes and theme components for ggplot2.
The core theme: theme_ipsum (“ipsum” is Latin for “precise”) uses
Arial Narrow which should be installed on practically any modern system,
so it’s “free”-ish. This font is condensed, has solid default kerning
pairs and geometric numbers. That’s what I consider the “font trifecta”
must-have for charts. An additional quality for fonts for charts is that
they have a diversity of weights. Arial Narrow (the one on most systems,
anyway) does not have said diversity but this quality is not (IMO) a
“must have”.
The following functions are implemented/objects are exported:
Themes:
theme_ipsum: Arial Narrowtheme_ipsum_gs: Goldman Sans Condensedtheme_ipsum_es: Econ Sans Condensedtheme_ipsum_rc: Roboto Condensedtheme_ipsum_ps: IBM Plex Sans fonttheme_ipsum_pub: Public Sanstheme_ipsum_tw: Titilium Webtheme_modern_rc: Roboto Condensed dark themetheme_ft_rc: Dark theme based on FT’s dark theme (Roboto Condensed)
Scales (that align with various themes):
scale_color_ipsum: Discrete color & fill scales based on the ipsum palettescale_colour_ipsum: Discrete color & fill scales based on the ipsum palettescale_fill_ipsum: Discrete color & fill scales based on the ipsum palettescale_color_ft: Discrete color & fill scales based on the FT palettescale_colour_ft: Discrete color & fill scales based on the FT palettescale_fill_ft: Discrete color & fill scales based on the FT palettescale_x_comma: X & Y scales with opinionated presets for percent & comma label formatsscale_x_percent: X & Y scales with opinionated presets for percent & comma label formatsscale_y_comma: X & Y scales with opinionated presets for percent & comma label formatsscale_y_percent: X & Y scales with opinionated presets for percent & comma label formats
Palettes/Named Colors:
ipsum_pal: A muted, qualitative color paletteft_cols: FT color paletteft_pal: A bright qualitative color paletteft_text_col: FT color palettebit12: A vector of 12 vibrant colors for categorical databit12_extended: List of 12 color palettes with 9 shades each for continuous interpolation
Fonts:
font_an: Arial Narrow font name R variable aliasesfont_es: Econ Sans font name R variable aliasesfont_es_bold: Econ Sans font name R variable aliasesfont_es_light: Econ Sans font name R variable aliasesfont_rc: Roboto Condensed font name R variable aliasesfont_rc_light: Roboto Condensed font name R variable aliasesfont_pub: Public Sans font name R variable aliasesfont_pub_bold: Public Sans font name R variable aliasesfont_pub_light: Public Sans font name R variable aliasesfont_pub_thin: Public Sans font name R variable aliasesfont_ps: PlexSans font name R variable aliasesfont_ps_light: PlexSans font name R variable aliases
Flexoki Color Scales:
scale_fill_flexoki_continuous: Continuous Fill Scale Using Flexoki Colorsscale_fill_flexoki_dark: Discrete Fill Scale Using Flexoki Dark Colorsscale_fill_flexoki_dark_distiller: Distiller Fill Scale Using Flexoki Dark Colorsscale_fill_flexoki_dark_spectrum: Distiller Fill Scale Across All Flexoki Dark Colorsscale_fill_flexoki_light: Discrete Fill Scale Using Flexoki Light Colorsscale_fill_flexoki_light_distiller: Distiller Fill Scale Using Flexoki Light Colorsscale_fill_flexoki_light_spectrum: Distiller Fill Scale Across All Flexoki Light Colors
Bit12 Color Scales:
scale_color_bit12: Discrete Color Scale Using Bit12 Colorsscale_fill_bit12: Discrete Fill Scale Using Bit12 Colorsscale_color_bit12_continuous: Continuous Color Scale Using Bit12 Colorsscale_fill_bit12_continuous: Continuous Fill Scale Using Bit12 Colorsscale_color_bit12_distiller: Distiller Color Scale Using Bit12 Colorsscale_fill_bit12_distiller: Distiller Fill Scale Using Bit12 Colorsscale_color_bit12_spectrum: Distiller Color Scale Across All Bit12 Colorsscale_fill_bit12_spectrum: Distiller Fill Scale Across All Bit12 Colors
Flexoki Palettes:
flexoki_light: Vector of 8 colors in the light variantflexoki_dark: Vector of 8 colors in the dark variantflexoki_extended: List of 8 color palettes with 13 shades each for continuous interpolation
Utilities:
flush_ticks: Makes axis text labels flush on the endsft_geom_defaults: Change geom defaults from black to custom lights for the FT themegg_check: Spell check ggplot2 plot labelsimport_econ_sans: Import Econ Sans Condensed font for use in chartsimport_plex_sans: Import IBM Plex Sans font for use in chartsimport_roboto_condensed: Import Roboto Condensed font for use in chartsmodern_geom_defaults: Change geom defaults from black to white for the modern themeupdate_geom_font_defaults: Update matching font defaults for text geoms
Installation
``` r install.packages("hrbrthemes") # NOTE: CRAN version is 0.8.7
or
remotes::install_git("https://codeberg.org/hrbrmstr/hrbrthemes.git") ```
NOTE: To use the ‘remotes’ install options you will need to have the {remotes} package installed.
Usage
``` r library(hrbrthemes) library(gcookbook) library(tidyverse)
current version
packageVersion("hrbrthemes")
[1] '0.9.2'
```
Base theme (Arial Narrow)
r
ggplot(mtcars, aes(mpg, wt)) +
geom_point() +
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'") +
theme_ipsum()

Roboto Condensed
r
ggplot(mtcars, aes(mpg, wt)) +
geom_point() +
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'") +
theme_ipsum_rc()

New FT Theme!
r
ggplot(mtcars, aes(mpg, wt)) +
geom_point(color = ft_cols$yellow) +
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'") +
theme_ft_rc()

IBM Plex Sans
``` r ggplot(mpg, aes(displ, hwy)) + geomjitter(aes(color=class, fill=class), size=3, shape=21, alpha=1/2) + scalexcontinuous(expand=c(0,0), limits=c(1, 8), breaks=1:8) + scaleycontinuous(expand=c(0,0), limits=c(10, 50)) + scalecoloripsum() + scalefillipsum() + facetwrap(~class, scales="free") + labs( title="IBM Plex Sans Test", subtitle="This is a subtitle to see the how it looks in IBM Plex Sans", caption="Source: hrbrthemes & IBM" ) + themeipsumps(grid="XY", axis="xy") + theme(legend.position="none") -> gg
flush_ticks(gg)
theme(axis.text.x=element_text(hjust=c(0, rep(0.5, 6), 1))) +
theme(axis.text.y=element_text(vjust=c(0, rep(0.5, 3), 1)))
```

Scales (Color/Fill)
r
ggplot(mtcars, aes(mpg, wt)) +
geom_point(aes(color=factor(carb))) +
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'") +
scale_color_ipsum() +
theme_ipsum_rc()

Scales (Axis)
r
count(mpg, class) %>%
mutate(pct=n/sum(n)) %>%
ggplot(aes(class, pct)) +
geom_col() +
scale_y_percent() +
labs(x="Fuel efficiency (mpg)", y="Weight (tons)",
title="Seminal ggplot2 column chart example with percents",
subtitle="A plot that is only useful for demonstration purposes",
caption="Brought to you by the letter 'g'") +
theme_ipsum(grid="Y")

r
ggplot(uspopage, aes(x=Year, y=Thousands, fill=AgeGroup)) +
geom_area() +
scale_fill_ipsum() +
scale_x_continuous(expand=c(0,0)) +
scale_y_comma() +
labs(title="Age distribution of population in the U.S., 1900-2002",
subtitle="Example data from the R Graphics Cookbook",
caption="Source: R Graphics Cookbook") +
theme_ipsum_rc(grid="XY") +
theme(axis.text.x=element_text(hjust=c(0, 0.5, 0.5, 0.5, 1))) +
theme(legend.position="bottom")

``` r updategeomfontdefaults(fontrc_light)
count(mpg, class) %>% mutate(n=n*2000) %>% arrange(n) %>% mutate(class=factor(class, levels=class)) %>% ggplot(aes(class, n)) + geomcol() + geomtext(aes(label=scales::comma(n)), hjust=0, nudgey=2000) + scaleycomma(limits=c(0,150000)) + coordflip() + labs(x="Fuel efficiency (mpg)", y="Weight (tons)", title="Seminal ggplot2 column chart example with commas", subtitle="A plot that is only useful for demonstration purposes, esp since you'd never\nreally want direct labels and axis labels", caption="Brought to you by the letter 'g'") + themeipsumrc(grid="X") ```

Spellcheck ggplot2 labels
``` r df <- data.frame(x=c(20, 25, 30), y=c(4, 4, 4), txt=c("One", "Two", "Three"))
ggplot(mtcars, aes(mpg, wt)) + geompoint() + labs(x="This is some txt", y="This is more text", title="Thisy is a titlle", subtitle="This is a subtitley", caption="This is a captien") + themeipsum_rc(grid="XY") -> gg
gg_check(gg)
Possible misspelled words in [title]: (Thisy, titlle)
Possible misspelled words in [subtitle]: (subtitley)
Possible misspelled words in [caption]: (captien)
```

Flexoki Color Scales
The Flexoki color system provides both discrete and continuous color scales in light and dark variants.
``` r
Discrete colors example with light variant
ggplot(mpg, aes(class, fill=class)) + geombar() + labs(title="Flexoki Light Colors", subtitle="Discrete color scale example", caption="Using scalefillflexokilight()") + themeipsum() + scalefillflexokilight() + theme(legend.position="none") ```

``` r
Dark variant with points
ggplot(mpg, aes(displ, hwy, color=class)) + geompoint(size=3) + labs(title="Flexoki Dark Colors", subtitle="Another discrete color example", caption="Using scalecolorflexokidark()") + themeipsumrc() + scalecolorflexoki_dark() ```

``` r library(patchwork)
data.frame( x = rep(1:50, 50), y = rep(1:50, each=50), z = sqrt((rep(1:50, 50)-25)^2 + (rep(1:50, each=50)-25)^2) ) -> grad_df
names(flexokidark) |> map((.p) { ggplot(graddf, aes(x, y, fill=z)) + geomtile() + scalefillflexokicontinuous(palette = .p) + labs( x = NULL, y = NULL ) + themeipsum(grid="") + theme(legend.position = "none") }) |> do.call(what = "wrapplots") + plotlayout(ncol = 4) + plotannotation( title="Flexoki Continuous Color Scales", subtitle="All 8 continuous color palettes", caption="Using scalefillflexokicontinuous()", theme = themeipsum(grid="") ) ```

Bit12 Color Scales
The Bit12 color system provides a set of 12 distinct colors optimized for data visualization.
``` r
Discrete colors example
ggplot(mpg, aes(class, fill=class)) + geombar() + labs(title="Bit12 Color Palette", subtitle="A vibrant 12-color categorical palette", caption="Using scalefillbit12()") + themeipsum() + scalefillbit12() + theme(legend.position="none") ```

``` r library(patchwork)
Taking a subset of the palette for this example
names(bit12)[c(1,3,5,7,9,11)] |> map((.p) { ggplot(graddf, aes(x, y, fill=z)) + geomtile() + scalefillbit12continuous(palette = .p) + labs( x = NULL, y = NULL, title = .p ) + themeipsum(grid="") + theme(legend.position = "none") }) |> do.call(what = "wrapplots") + plotlayout(ncol = 3) + plotannotation( title="Bit12 Continuous Color Scales", subtitle="Selected continuous color palettes", caption="Using scalefillbit12continuous()", theme = theme_ipsum(grid="") ) ```

hrbrthemes Metrics
| Lang | # Files | (%) | LoC | (%) | Blank lines | (%) | # Lines | (%) | |:-----|---------:|-----:|-----:|-----:|------------:|----:|---------:|----:| | R | 23 | 0.44 | 1840 | 0.46 | 339 | 0.5 | 1290 | 0.5 | | SVG | 2 | 0.04 | 150 | 0.04 | 0 | 0.0 | 0 | 0.0 | | JSON | 1 | 0.02 | 15 | 0.00 | 0 | 0.0 | 0 | 0.0 | | SUM | 26 | 0.50 | 2005 | 0.50 | 339 | 0.5 | 1290 | 0.5 |
{cloc} 📦 metrics for hrbrthemes
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.
Owner
- Name: boB Rudis
- Login: hrbrmstr
- Kind: user
- Location: Maine
- Company: GreyNoise Intelligence
- Website: https://rud.is/
- Repositories: 716
- Profile: https://github.com/hrbrmstr
🇺🇦 Pampa • Don't look at me…I do what he does—just slower. #rstats avuncular•👨🍳•✝️• 💤• Varaforseti í Gögn Vísindi @ @GreyNoise-Intelligence +CMU Lecturer
GitHub Events
Total
- Watch event: 62
- Issue comment event: 2
- Push event: 8
- Pull request event: 2
- Fork event: 3
Last Year
- Watch event: 62
- Issue comment event: 2
- Push event: 8
- Pull request event: 2
- Fork event: 3
Committers
Last synced: 9 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| boB Rudis | b****b@r****s | 121 |
| Joris Meys | J****s@U****e | 3 |
| xvrdm | x****d@p****m | 3 |
| jabarnett | j****t@t****m | 2 |
| mpancia | m****p@t****g | 1 |
| karldw | k****w | 1 |
| Xavier A | x****m | 1 |
| Phil | p****o | 1 |
| Lukas Burk | j****2 | 1 |
| Jacob | j****t@g****m | 1 |
| George Kampolis | g****s@o****m | 1 |
| Ben Marwick | b****k@h****m | 1 |
| Tiago Henriques | b****n@b****u | 1 |
| Bhaskar Karambelkar | b****k@g****m | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 9 months ago
All Time
- Total issues: 47
- Total pull requests: 24
- Average time to close issues: about 1 month
- Average time to close pull requests: about 2 months
- Total issue authors: 39
- Total pull request authors: 19
- Average comments per issue: 3.87
- Average comments per pull request: 1.75
- Merged pull requests: 11
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 1
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 1
- Pull request authors: 0
- Average comments per issue: 0.0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- seabass011 (4)
- bhaskarvk (2)
- hrbrmstr (2)
- dmi3kno (2)
- davidski (2)
- IndrajeetPatil (2)
- JiaxiangBU (1)
- mevers (1)
- srgmld (1)
- PaulC91 (1)
- AntoniniP (1)
- jamiecchiu (1)
- Ax3man (1)
- pkq (1)
- zx8754 (1)
Pull Request Authors
- xvrdm (3)
- danwwilson (2)
- ghost (2)
- phillyo (2)
- mevers (1)
- alexwhan (1)
- tbates (1)
- teunbrand (1)
- karldw (1)
- datawookie (1)
- mpancia (1)
- JoFAM (1)
- alistaire47 (1)
- gkampolis (1)
- bhaskarvk (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 2
- Total downloads: unknown
-
Total dependent packages: 2
(may contain duplicates) -
Total dependent repositories: 3
(may contain duplicates) - Total versions: 7
proxy.golang.org: github.com/hrbrmstr/hrbrthemes
- Documentation: https://pkg.go.dev/github.com/hrbrmstr/hrbrthemes#section-documentation
- License: other
-
Latest release: v0.6.0
published about 7 years ago
Rankings
conda-forge.org: r-hrbrthemes
- Homepage: http://github.com/hrbrmstr/hrbrthemes
- License: MIT
-
Latest release: 0.8.0
published almost 6 years ago
Rankings
Dependencies
- R >= 4.0.0 depends
- extrafont * imports
- gdtools * imports
- ggplot2 >= 3.4.0 imports
- grDevices * imports
- grid * imports
- magrittr * imports
- scales * imports
- tools * imports
- utils * imports
- clipr * suggests
- dplyr * suggests
- gcookbook * suggests
- gridExtra * suggests
- hunspell * suggests
- stringi * suggests
- svglite * suggests
- testthat * suggests
- vdiffr * suggests

