diff --git a/DESCRIPTION b/DESCRIPTION
index 42eb2bc..8622172 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -58,5 +58,5 @@ Imports:
tools,
magrittr,
gdtools
-RoxygenNote: 7.1.1
+RoxygenNote: 7.1.2
VignetteBuilder: knitr
diff --git a/R/econ-sans.R b/R/econ-sans.R
index 81f21e5..b291aaf 100644
--- a/R/econ-sans.R
+++ b/R/econ-sans.R
@@ -1,4 +1,4 @@
-#' A precise & pristine [ggplot2] theme with opinionated defaults and an emphasis on typoghraphy
+#' A precise & pristine [ggplot2] theme with opinionated defaults and an emphasis on typography
#'
#' You should [import_econ_sans()] first and also install the fonts on your
#' system before trying to use this theme.
@@ -15,13 +15,13 @@
#'
#' @md
#' @param base_family,base_size base font family and size
-#' @param plot_title_family,plot_title_face,plot_title_size,plot_title_margin plot tilte family, face, size and margin
+#' @param plot_title_family,plot_title_face,plot_title_size,plot_title_margin plot title family, face, size and margin
#' @param subtitle_family,subtitle_face,subtitle_size plot subtitle family, face and size
#' @param subtitle_margin plot subtitle margin bottom (single numeric value)
#' @param strip_text_family,strip_text_face,strip_text_size facet label font family, face and size
#' @param caption_family,caption_face,caption_size,caption_margin plot caption family, face, size and margin
#' @param axis_title_family,axis_title_face,axis_title_size axis title font family, face and size
-#' @param axis_title_just axis title font justificationk one of `[blmcrt]`
+#' @param axis_title_just axis title font justification; one of `[blmcrt]`
#' @param axis_text_size font size of axis text
#' @param plot_margin plot margin (specify with [ggplot2::margin])
#' @param panel_spacing panel spacing (use `unit()`)
diff --git a/R/flush-ticks.R b/R/flush-ticks.R
index f33f489..f52adee 100644
--- a/R/flush-ticks.R
+++ b/R/flush-ticks.R
@@ -1,11 +1,11 @@
#' Makes axis text labels flush on the ends
#'
-#' A covenience function intended for basic, fixed-scale plots only (i.e. does not handle
+#' A convenience function intended for basic, fixed-scale plots only (i.e. does not handle
#' free scales in facets).\cr
#' \cr
#' You need to pass in a ggplot2 object to this function. It can't be `+`'d in a chain
#' of geoms, coords, scales, themes, etc. It also builds the plot (but does not display
-#' it) so if the plt takes a while (i.e. has lots of data or transforms) this will also
+#' it) so if the plot takes a while (i.e. has lots of data or transforms) this will also
#' take a while.
#'
#' @md
diff --git a/R/goldmansans.R b/R/goldmansans.R
index 3a06772..7f7ef12 100644
--- a/R/goldmansans.R
+++ b/R/goldmansans.R
@@ -1,4 +1,4 @@
-#' A precise & pristine [ggplot2] theme with opinionated defaults and an emphasis on typoghraphy
+#' A precise & pristine [ggplot2] theme with opinionated defaults and an emphasis on typography
#'
#' You should [import_goldman_sans()] first and also install the fonts on your
#' system before trying to use this theme.
@@ -14,13 +14,13 @@
#'
#' @md
#' @param base_family,base_size base font family and size
-#' @param plot_title_family,plot_title_face,plot_title_size,plot_title_margin plot tilte family, face, size and margin
+#' @param plot_title_family,plot_title_face,plot_title_size,plot_title_margin plot title family, face, size and margin
#' @param subtitle_family,subtitle_face,subtitle_size plot subtitle family, face and size
#' @param subtitle_margin plot subtitle margin bottom (single numeric value)
#' @param strip_text_family,strip_text_face,strip_text_size facet label font family, face and size
#' @param caption_family,caption_face,caption_size,caption_margin plot caption family, face, size and margin
#' @param axis_title_family,axis_title_face,axis_title_size axis title font family, face and size
-#' @param axis_title_just axis title font justificationk one of `[blmcrt]`
+#' @param axis_title_just axis title font justification; one of `[blmcrt]`
#' @param axis_text_size font size of axis text
#' @param plot_margin plot margin (specify with [ggplot2::margin])
#' @param grid_col grid color
diff --git a/R/inter.R b/R/inter.R
index 5cb309c..dbaa944 100644
--- a/R/inter.R
+++ b/R/inter.R
@@ -1,4 +1,4 @@
-#' A precise & pristine [ggplot2] theme with opinionated defaults and an emphasis on typoghraphy
+#' A precise & pristine [ggplot2] theme with opinionated defaults and an emphasis on typography
#'
#' You should [import_inter()] first and also install the fonts on your
#' system before trying to use this theme.
@@ -14,14 +14,14 @@
#'
#' @md
#' @param base_family,base_size base font family and size
-#' @param plot_title_family,plot_title_face,plot_title_size,plot_title_margin plot tilte family, face, size and margin
+#' @param plot_title_family,plot_title_face,plot_title_size,plot_title_margin plot title family, face, size and margin
#' @param subtitle_family,subtitle_face,subtitle_size plot subtitle family, face and size
#' @param subtitle_margin plot subtitle margin bottom (single numeric value)
#' @param strip_text_family,strip_text_face,strip_text_size facet label font family, face and size
#' @param caption_family,caption_face,caption_size,caption_margin plot caption family, face, size and margin
+#' @param axis_text_family,axis_text_face,axis_text_size axis text font family, face, and size
#' @param axis_title_family,axis_title_face,axis_title_size axis title font family, face and size
-#' @param axis_title_just axis title font justificationk one of `[blmcrt]`
-#' @param axis_text_size font size of axis text
+#' @param axis_title_just axis title font justification; one of `[blmcrt]`
#' @param plot_margin plot margin (specify with [ggplot2::margin])
#' @param grid_col grid color
#' @param grid panel grid (`TRUE`, `FALSE`, or a combination of `X`, `x`, `Y`, `y`)
diff --git a/R/ipsum.r b/R/ipsum.r
index af5fa52..5867fbe 100644
--- a/R/ipsum.r
+++ b/R/ipsum.r
@@ -6,6 +6,7 @@
#' @param toc,toc_depth TOC params
#' @param extra_dependencies,... Additional function arguments to pass to the
#' base R Markdown HTML output formatter
+#' @param smart Deprecated
#' @export
ipsum <- function(number_sections = FALSE,
fig_width = 7,
@@ -90,7 +91,6 @@ ipsum <- function(number_sections = FALSE,
clean_supporting = self_contained,
pre_processor = pre_processor,
base_format = rmarkdown::html_document_base(
- smart = smart,
theme = theme,
self_contained = self_contained,
lib_dir = lib_dir,
diff --git a/R/plexsans.R b/R/plexsans.R
index 860b7c7..8aee0f8 100644
--- a/R/plexsans.R
+++ b/R/plexsans.R
@@ -1,4 +1,4 @@
-#' A precise & pristine [ggplot2] theme with opinionated defaults and an emphasis on typoghraphy
+#' A precise & pristine [ggplot2] theme with opinionated defaults and an emphasis on typography
#'
#' You should [import_plex_sans()] first and also install the fonts on your
#' system before trying to use this theme.
@@ -15,13 +15,13 @@
#'
#' @md
#' @param base_family,base_size base font family and size
-#' @param plot_title_family,plot_title_face,plot_title_size,plot_title_margin plot tilte family, face, size and margin
+#' @param plot_title_family,plot_title_face,plot_title_size,plot_title_margin plot title family, face, size and margin
#' @param subtitle_family,subtitle_face,subtitle_size plot subtitle family, face and size
#' @param subtitle_margin plot subtitle margin bottom (single numeric value)
#' @param strip_text_family,strip_text_face,strip_text_size facet label font family, face and size
#' @param caption_family,caption_face,caption_size,caption_margin plot caption family, face, size and margin
#' @param axis_title_family,axis_title_face,axis_title_size axis title font family, face and size
-#' @param axis_title_just axis title font justificationk one of `[blmcrt]`
+#' @param axis_title_just axis title font justification; one of `[blmcrt]`
#' @param axis_text_size font size of axis text
#' @param plot_margin plot margin (specify with [ggplot2::margin])
#' @param grid_col grid color
diff --git a/R/public-sans.R b/R/public-sans.R
index d854b23..a7a94e0 100644
--- a/R/public-sans.R
+++ b/R/public-sans.R
@@ -1,4 +1,4 @@
-#' A precise & pristine [ggplot2] theme with opinionated defaults and an emphasis on typoghraphy
+#' A precise & pristine [ggplot2] theme with opinionated defaults and an emphasis on typography
#'
#' You should [import_public_sans()] first and also install the fonts on your
#' system before trying to use this theme.
@@ -15,13 +15,13 @@
#'
#' @md
#' @param base_family,base_size base font family and size
-#' @param plot_title_family,plot_title_face,plot_title_size,plot_title_margin plot tilte family, face, size and margin
+#' @param plot_title_family,plot_title_face,plot_title_size,plot_title_margin plot title family, face, size and margin
#' @param subtitle_family,subtitle_face,subtitle_size plot subtitle family, face and size
#' @param subtitle_margin plot subtitle margin bottom (single numeric value)
#' @param strip_text_family,strip_text_face,strip_text_size facet label font family, face and size
#' @param caption_family,caption_face,caption_size,caption_margin plot caption family, face, size and margin
#' @param axis_title_family,axis_title_face,axis_title_size axis title font family, face and size
-#' @param axis_title_just axis title font justificationk one of `[blmcrt]`
+#' @param axis_title_just axis title font justification; one of `[blmcrt]`
#' @param axis_text_size font size of axis text
#' @param plot_margin plot margin (specify with [ggplot2::margin])
#' @param grid_col grid color
diff --git a/R/roboto-condensed.r b/R/roboto-condensed.r
index 14ae83d..f3686a8 100644
--- a/R/roboto-condensed.r
+++ b/R/roboto-condensed.r
@@ -1,4 +1,4 @@
-#' A precise & pristine [ggplot2] theme with opinionated defaults and an emphasis on typoghraphy
+#' A precise & pristine [ggplot2] theme with opinionated defaults and an emphasis on typography
#'
#' You should [import_roboto_condensed()] first and also install the fonts on your
#' system before trying to use this theme.
@@ -15,13 +15,13 @@
#'
#' @md
#' @param base_family,base_size base font family and size
-#' @param plot_title_family,plot_title_face,plot_title_size,plot_title_margin plot tilte family, face, size and margin
+#' @param plot_title_family,plot_title_face,plot_title_size,plot_title_margin plot title family, face, size and margin
#' @param subtitle_family,subtitle_face,subtitle_size plot subtitle family, face and size
#' @param subtitle_margin plot subtitle margin bottom (single numeric value)
#' @param strip_text_family,strip_text_face,strip_text_size facet label font family, face and size
#' @param caption_family,caption_face,caption_size,caption_margin plot caption family, face, size and margin
#' @param axis_title_family,axis_title_face,axis_title_size axis title font family, face and size
-#' @param axis_title_just axis title font justificationk one of `[blmcrt]`
+#' @param axis_title_just axis title font justification; one of `[blmcrt]`
#' @param axis_text_size font size of axis text
#' @param plot_margin plot margin (specify with [ggplot2::margin])
#' @param panel_spacing panel spacing (use `unit()`)
diff --git a/R/scales.r b/R/scales.r
index 5cd399f..b22b281 100644
--- a/R/scales.r
+++ b/R/scales.r
@@ -3,11 +3,11 @@ is.waive <- function (x) { inherits(x, "waiver") }
is.sec_axis <- function (x) { inherits(x, "AxisSecondary") }
is.formula <- function (x) { inherits(x, "formula") }
-#' X & Y scales with opinionated pre-sets for percent & comma label formats
+#' X & Y scales with opinionated presets for percent & comma label formats
#'
#' The `_comma` ones set comma format for axis text and `expand=c(0,0)` (you need to set limits).
#'
-#' The `_percent` ones set precent format for axis text and `expand=c(0,0)` (you need to set limits).
+#' The `_percent` ones set percent format for axis text and `expand=c(0,0)` (you need to set limits).
#'
#' @md
#' @param name The name of the scale. Used as axis or legend title. If
diff --git a/R/tinyhand.R b/R/tinyhand.R
index 546e5d1..08dab22 100644
--- a/R/tinyhand.R
+++ b/R/tinyhand.R
@@ -24,13 +24,13 @@ font_th <- "BFTinyHand-Regular"
#'
#' @md
#' @param base_family,base_size base font family and size
-#' @param plot_title_family,plot_title_face,plot_title_size,plot_title_margin plot tilte family, face, size and margin
+#' @param plot_title_family,plot_title_face,plot_title_size,plot_title_margin plot title family, face, size and margin
#' @param subtitle_family,subtitle_face,subtitle_size plot subtitle family, face and size
#' @param subtitle_margin plot subtitle margin bottom (single numeric value)
#' @param strip_text_family,strip_text_face,strip_text_size facet label font family, face and size
#' @param caption_family,caption_face,caption_size,caption_margin plot caption family, face, size and margin
#' @param axis_title_family,axis_title_face,axis_title_size axis title font family, face and size
-#' @param axis_title_just axis title font justificationk one of `[blmcrt]`
+#' @param axis_title_just axis title font justification; one of `[blmcrt]`
#' @param axis_text_size font size of axis text
#' @param plot_margin plot margin (specify with [ggplot2::margin])
#' @param grid_col grid color
diff --git a/R/titillium-web.R b/R/titillium-web.R
index b4db023..cc09aae 100644
--- a/R/titillium-web.R
+++ b/R/titillium-web.R
@@ -1,4 +1,4 @@
-#' A precise & pristine [ggplot2] theme with opinionated defaults and an emphasis on typoghraphy
+#' A precise & pristine [ggplot2] theme with opinionated defaults and an emphasis on typography
#'
#' You should [import_titillium_web()] first and also install the fonts on your
#' system before trying to use this theme.
@@ -15,13 +15,13 @@
#'
#' @md
#' @param base_family,base_size base font family and size
-#' @param plot_title_family,plot_title_face,plot_title_size,plot_title_margin plot tilte family, face, size and margin
+#' @param plot_title_family,plot_title_face,plot_title_size,plot_title_margin plot title family, face, size and margin
#' @param subtitle_family,subtitle_face,subtitle_size plot subtitle family, face and size
#' @param subtitle_margin plot subtitle margin bottom (single numeric value)
#' @param strip_text_family,strip_text_face,strip_text_size facet label font family, face and size
#' @param caption_family,caption_face,caption_size,caption_margin plot caption family, face, size and margin
#' @param axis_title_family,axis_title_face,axis_title_size axis title font family, face and size
-#' @param axis_title_just axis title font justificationk one of `[blmcrt]`
+#' @param axis_title_just axis title font justification; one of `[blmcrt]`
#' @param axis_text_size font size of axis text
#' @param plot_margin plot margin (specify with [ggplot2::margin])
#' @param grid_col grid color
diff --git a/README.Rmd b/README.Rmd
index 99e86f9..16ac3a2 100644
--- a/README.Rmd
+++ b/README.Rmd
@@ -34,7 +34,7 @@ Themes:
- `theme_ipsum_rc`: Roboto Condensed
- `theme_ipsum_ps`: IBM Plex Sans font
- `theme_ipsum_pub`: Public Sans
-- `theme_ipsum_tw`: Titilium Web
+- `theme_ipsum_tw`: Titillium Web
- `theme_modern_rc`: Roboto Condensed dark theme
- `theme_ft_rc`: Dark theme based on FT's dark theme (Roboto Condensed)
@@ -273,4 +273,4 @@ 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.
\ No newline at end of file
+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.
diff --git a/README.md b/README.md
index 69004ae..6f31337 100644
--- a/README.md
+++ b/README.md
@@ -49,7 +49,7 @@ Themes:
- `theme_ipsum_rc`: Roboto Condensed
- `theme_ipsum_ps`: IBM Plex Sans font
- `theme_ipsum_pub`: Public Sans
- - `theme_ipsum_tw`: Titilium Web
+ - `theme_ipsum_tw`: Titillium Web
- `theme_modern_rc`: Roboto Condensed dark theme
- `theme_ft_rc`: Dark theme based on FT’s dark theme (Roboto
Condensed)
diff --git a/_pkgdown.yml b/_pkgdown.yml
new file mode 100644
index 0000000..ed67985
--- /dev/null
+++ b/_pkgdown.yml
@@ -0,0 +1 @@
+url: https://cinc.rud.is/web/packages/hrbrthemes
diff --git a/docs/404.html b/docs/404.html
new file mode 100644
index 0000000..ce75fbf
--- /dev/null
+++ b/docs/404.html
@@ -0,0 +1,115 @@
+
+
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
The hrbrthemes package has two goals. First, it provides a base theme that focuses on typographic elements, including where various labels are placed as well as the fonts that are used. The second goal centers around productivity for a production workflow. In fact, this “production workflow” is the context for where the elements of hrbrthemes should be used.
A “production workflow” is when you intend for the output of your work to be put into a publication of some kind, whether it be a blog post, academic paper, presentation, internal report or industry publication. When you’re cranking through an analysis, the visual elements don’t need to be perfect. They are there to validate/support your work and are more of a starting point for the finished product than anything else. The level of attention to detail on the final graphical products can be a great motivator for your audience to either dive deep into your analysis text or relegate it to the TLDR pile.
-
-
-Font Fundamentals
+
+
Font Fundamentals
+
There are nigh countless tomes written about the colors you should consider using in charts as well as how to produce “minimal” charts (i.e. eliminate “chart junk”). One area that is rarely discussed is the use of fonts in charts (i.e. chart typography). The hrbrthemes package is very opinionated about chart typography:
The font family used should be sans-serif typeface
@@ -107,26 +105,26 @@
Ideally, the font family used will have 100, 300, 500, 700 and 900 weights vs regular, bold, italic and bold italic
Because we’re working in ggplot2-land, the font family used should also be a TrueType font (TTF)
-
-
-Why sans-serif?
+
+
Why sans-serif?
+
To use a gross oversimplification, there are two basic font types: Serif and Sans-serif (that’s a lie of convenience, there are more than two). hrbrthemes suggests using sans-serif fonts since they have a more “modern” feel to them, you’re not producing long-form text and labels on charts may need to scale down to small sizes. Typography nerds on either side of the serif vs sans-serif debate can point to 100+ years of research-based evidence supporting their particular “side”.
You can compare the typography in the two (non-hrbrthemes) charts below to see if you prefer sans-serif over serif:
If you work in a company, your communications department likely has a set of core brand fonts and said font groups likely contain both serif and sans-serif and you should strive to keep with the brand image and use whatever font(s) work best or work with your comms team to pick a standard, complementary font for the charts you produce.
-
-
-Kern-what?
-
Kerning is nothing more than a fancy word for spaces between letters and fonts have built-in tables for how various pairs of letters should be placed next to each other. Great fonts have kerning tables that typography nerds immediately recognize and adore. Fonts with poor kerning tables are easily recognized as such by even the least font-aware viewer.
+
+
Kern-what?
+
+
Kerning is nothing more than a fancy word for spaces between letters and fonts have built-in tables for how various pairs of letters should be placed next to each other. Great fonts have kerning tables that typography nerds immediately recognize and adore. Fonts with poor kerning tables are easily recognized as such by even the least font-aware viewer.
Bad kerning will be a distraction from the chart contents. Great kerning will be a subconscious reinforcement of just how awesome your visualizations are.
-
-
-Tabula Figura
+
+
Tabula Figura
+
Tabular digits line up when placed on top of each other. Proportional ones do not. This is best explained visually:
@@ -134,16 +132,16 @@
Can you spot the proportional digits from the tabular ones? (Hint: there are two of each.)
Proportional digits stand out (in a “yes, I just spilled sriracha on my white shirt” way) when used on the Y axis of a chart and the numeric labels contain numbers of varying widths (like Hind and Encode Sans Condensed in the example above). Using proportional digits will be one further, subtle, subliminal message to viewers that there is something not-quite-awesome about your creation.
-
-
-Clean and compact
-
The figure used in the previous section provided an example of condensed/narrow fonts and regular. Chart space is at a premium and it’s important to label and annotate your creations (sparingly but sufficiently). Choosing a font that is too wide will reduce your available space and also make it harder to read the text. Choosing a font that is too narrow/compressed/condensed will create different legiibility problems.
+
+
Clean and compact
+
+
The figure used in the previous section provided an example of condensed/narrow fonts and regular. Chart space is at a premium and it’s important to label and annotate your creations (sparingly but sufficiently). Choosing a font that is too wide will reduce your available space and also make it harder to read the text. Choosing a font that is too narrow/compressed/condensed will create different legibility problems.
NOTE: It’s really hard to find a free condensed/narrow font with great kerning pairs and tabular digits. Such is the way of things.
(As an aside, the default line-height for Hind and M+ 1c is also sub-optimal and would require tweaking in ggplot2 calls to correct.)
-
-
-Weight. What?
+
+
Weight. What?
+
Most fonts (and, more importantly, most free fonts) come in regular, italic, bold and bold italic (which I can’t bring myself to code in here). You really want to avoid italic and bold italic, especially at very small or very large sizes. Bold should be used sparingly as it draws the eye to that text.
Ideally, you’d use a font with a broad diversity of weights. The term weight can be though of as a numeric scale (the one used here was introduced by TrueType) between 100 and 900 (usually at 100 or 200 increments) or with names ranging from “hairline” through “ultra-black”.
Take Open Sans, for example:
@@ -152,46 +150,48 @@
There is plenty of room to work with in Open Sans. You can embolden the title, but mute the other labels and choose appropriate label fonts to both enhance style as well as reduce importance. Lighter weights are great for captions and even some direct annotations. Heaver weights should be used sparingly and for emphasis.
-
-
-TTF. Meh.
-
I’ll use another over-simplification and state that there two main font types: OTF and TTF (it’s another lie of convenience). OTF (OpenType) is more modern and flexible. TTF (TrueType) has been around longer and was a precursor to OTF. If you make PDFs or PostScript files from R you pretty much need to use TTF fonts due to the underlying tooling that it relies on. If you are making PNGs or SVGs you can likely use OTF but most communciations teams and publications want PDFs.
+
+
TTF. Meh.
+
+
I’ll use another over-simplification and state that there two main font types: OTF and TTF (it’s another lie of convenience). OTF (OpenType) is more modern and flexible. TTF (TrueType) has been around longer and was a precursor to OTF. If you make PDFs or PostScript files from R you pretty much need to use TTF fonts due to the underlying tooling that it relies on. If you are making PNGs or SVGs you can likely use OTF but most communications teams and publications want PDFs.
-
-
-Spacing Out
+
+
Spacing Out
+
Label/title placement is also important, as is the distance between those elements. Put text bits too close to each other or too far apart from each other will send negative subliminal messages. Centering vs left- or right-justification will also convey other messages (old-school vs modern, to put it somewhat bluntly).
hrbrthemes makes opinionated choices over the spacing between title elements and all labels. For some elements, it makes very new choices (such as the justification of the axis labels).
The font choices you make may cause you to adjust the hrbrthemes defaults, especially if you choose a font with a wonky line-height.
Google. Copyright holder.
- Roboto Condensed & Titillium Web Fonts
-
-
-
IBM. Copyright holder.
- Plex Sans Font
-
-
-
Jacob Barnett. Contributor.
-
-
-
-
Thomas J. Leeper. Contributor.
-
-
-
-
Joris Meys. Contributor.
-
-
-
+
+
Rudis B (2022).
+hrbrthemes: Additional Themes, Theme Components and Utilities for 'ggplot2'.
+R package version 0.8.6, http://github.com/hrbrmstr/hrbrthemes.
+
+
@Manual{,
+ title = {hrbrthemes: Additional Themes, Theme Components and Utilities for 'ggplot2'},
+ author = {Bob Rudis},
+ year = {2022},
+ note = {R package version 0.8.6},
+ url = {http://github.com/hrbrmstr/hrbrthemes},
+}
-
+
+
+
-
-
+
diff --git a/docs/bootstrap-toc.css b/docs/bootstrap-toc.css
new file mode 100644
index 0000000..5a85941
--- /dev/null
+++ b/docs/bootstrap-toc.css
@@ -0,0 +1,60 @@
+/*!
+ * Bootstrap Table of Contents v0.4.1 (http://afeld.github.io/bootstrap-toc/)
+ * Copyright 2015 Aidan Feldman
+ * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */
+
+/* modified from https://github.com/twbs/bootstrap/blob/94b4076dd2efba9af71f0b18d4ee4b163aa9e0dd/docs/assets/css/src/docs.css#L548-L601 */
+
+/* All levels of nav */
+nav[data-toggle='toc'] .nav > li > a {
+ display: block;
+ padding: 4px 20px;
+ font-size: 13px;
+ font-weight: 500;
+ color: #767676;
+}
+nav[data-toggle='toc'] .nav > li > a:hover,
+nav[data-toggle='toc'] .nav > li > a:focus {
+ padding-left: 19px;
+ color: #563d7c;
+ text-decoration: none;
+ background-color: transparent;
+ border-left: 1px solid #563d7c;
+}
+nav[data-toggle='toc'] .nav > .active > a,
+nav[data-toggle='toc'] .nav > .active:hover > a,
+nav[data-toggle='toc'] .nav > .active:focus > a {
+ padding-left: 18px;
+ font-weight: bold;
+ color: #563d7c;
+ background-color: transparent;
+ border-left: 2px solid #563d7c;
+}
+
+/* Nav: second level (shown on .active) */
+nav[data-toggle='toc'] .nav .nav {
+ display: none; /* Hide by default, but at >768px, show it */
+ padding-bottom: 10px;
+}
+nav[data-toggle='toc'] .nav .nav > li > a {
+ padding-top: 1px;
+ padding-bottom: 1px;
+ padding-left: 30px;
+ font-size: 12px;
+ font-weight: normal;
+}
+nav[data-toggle='toc'] .nav .nav > li > a:hover,
+nav[data-toggle='toc'] .nav .nav > li > a:focus {
+ padding-left: 29px;
+}
+nav[data-toggle='toc'] .nav .nav > .active > a,
+nav[data-toggle='toc'] .nav .nav > .active:hover > a,
+nav[data-toggle='toc'] .nav .nav > .active:focus > a {
+ padding-left: 28px;
+ font-weight: 500;
+}
+
+/* from https://github.com/twbs/bootstrap/blob/e38f066d8c203c3e032da0ff23cd2d6098ee2dd6/docs/assets/css/src/docs.css#L631-L634 */
+nav[data-toggle='toc'] .nav > .active > ul {
+ display: block;
+}
diff --git a/docs/bootstrap-toc.js b/docs/bootstrap-toc.js
new file mode 100644
index 0000000..1cdd573
--- /dev/null
+++ b/docs/bootstrap-toc.js
@@ -0,0 +1,159 @@
+/*!
+ * Bootstrap Table of Contents v0.4.1 (http://afeld.github.io/bootstrap-toc/)
+ * Copyright 2015 Aidan Feldman
+ * Licensed under MIT (https://github.com/afeld/bootstrap-toc/blob/gh-pages/LICENSE.md) */
+(function() {
+ 'use strict';
+
+ window.Toc = {
+ helpers: {
+ // return all matching elements in the set, or their descendants
+ findOrFilter: function($el, selector) {
+ // http://danielnouri.org/notes/2011/03/14/a-jquery-find-that-also-finds-the-root-element/
+ // http://stackoverflow.com/a/12731439/358804
+ var $descendants = $el.find(selector);
+ return $el.filter(selector).add($descendants).filter(':not([data-toc-skip])');
+ },
+
+ generateUniqueIdBase: function(el) {
+ var text = $(el).text();
+ var anchor = text.trim().toLowerCase().replace(/[^A-Za-z0-9]+/g, '-');
+ return anchor || el.tagName.toLowerCase();
+ },
+
+ generateUniqueId: function(el) {
+ var anchorBase = this.generateUniqueIdBase(el);
+ for (var i = 0; ; i++) {
+ var anchor = anchorBase;
+ if (i > 0) {
+ // add suffix
+ anchor += '-' + i;
+ }
+ // check if ID already exists
+ if (!document.getElementById(anchor)) {
+ return anchor;
+ }
+ }
+ },
+
+ generateAnchor: function(el) {
+ if (el.id) {
+ return el.id;
+ } else {
+ var anchor = this.generateUniqueId(el);
+ el.id = anchor;
+ return anchor;
+ }
+ },
+
+ createNavList: function() {
+ return $('
');
+ },
+
+ createChildNavList: function($parent) {
+ var $childList = this.createNavList();
+ $parent.append($childList);
+ return $childList;
+ },
+
+ generateNavEl: function(anchor, text) {
+ var $a = $('');
+ $a.attr('href', '#' + anchor);
+ $a.text(text);
+ var $li = $('');
+ $li.append($a);
+ return $li;
+ },
+
+ generateNavItem: function(headingEl) {
+ var anchor = this.generateAnchor(headingEl);
+ var $heading = $(headingEl);
+ var text = $heading.data('toc-text') || $heading.text();
+ return this.generateNavEl(anchor, text);
+ },
+
+ // Find the first heading level (`
`, then `
`, etc.) that has more than one element. Defaults to 1 (for `
`).
+ getTopLevel: function($scope) {
+ for (var i = 1; i <= 6; i++) {
+ var $headings = this.findOrFilter($scope, 'h' + i);
+ if ($headings.length > 1) {
+ return i;
+ }
+ }
+
+ return 1;
+ },
+
+ // returns the elements for the top level, and the next below it
+ getHeadings: function($scope, topLevel) {
+ var topSelector = 'h' + topLevel;
+
+ var secondaryLevel = topLevel + 1;
+ var secondarySelector = 'h' + secondaryLevel;
+
+ return this.findOrFilter($scope, topSelector + ',' + secondarySelector);
+ },
+
+ getNavLevel: function(el) {
+ return parseInt(el.tagName.charAt(1), 10);
+ },
+
+ populateNav: function($topContext, topLevel, $headings) {
+ var $context = $topContext;
+ var $prevNav;
+
+ var helpers = this;
+ $headings.each(function(i, el) {
+ var $newNav = helpers.generateNavItem(el);
+ var navLevel = helpers.getNavLevel(el);
+
+ // determine the proper $context
+ if (navLevel === topLevel) {
+ // use top level
+ $context = $topContext;
+ } else if ($prevNav && $context === $topContext) {
+ // create a new level of the tree and switch to it
+ $context = helpers.createChildNavList($prevNav);
+ } // else use the current $context
+
+ $context.append($newNav);
+
+ $prevNav = $newNav;
+ });
+ },
+
+ parseOps: function(arg) {
+ var opts;
+ if (arg.jquery) {
+ opts = {
+ $nav: arg
+ };
+ } else {
+ opts = arg;
+ }
+ opts.$scope = opts.$scope || $(document.body);
+ return opts;
+ }
+ },
+
+ // accepts a jQuery object, or an options object
+ init: function(opts) {
+ opts = this.helpers.parseOps(opts);
+
+ // ensure that the data attribute is in place for styling
+ opts.$nav.attr('data-toggle', 'toc');
+
+ var $topContext = this.helpers.createChildNavList(opts.$nav);
+ var topLevel = this.helpers.getTopLevel(opts.$scope);
+ var $headings = this.helpers.getHeadings(opts.$scope, topLevel);
+ this.helpers.populateNav($topContext, topLevel, $headings);
+ }
+ };
+
+ $(function() {
+ $('nav[data-toggle="toc"]').each(function(i, el) {
+ var $nav = $(el);
+ Toc.init($nav);
+ });
+ });
+})();
diff --git a/docs/index.html b/docs/index.html
index d615dc2..5165a94 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -5,24 +5,28 @@
-Additional Themes, Theme Components and Utilities for 'ggplot2' • hrbrthemes
-
-
-
-
-
+
+
+
+
+
+
-
-
+
+
+
-hrbrthemes : Additional Themes and Theme Components for ‘ggplot2’
-
+
+
+
+
hrbrthemes
+
+
Additional Themes and Theme Components for ‘ggplot2’
-
This is a very focused package that provides typography-centric themes and theme components for ggplot2. It’s a an extract/riff of hrbrmisc created by request.
+
This is a very focused package that provides typography-centric themes and theme components for ggplot2. It’s a an extract/riff of hrbrmisc created by request.
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_ft_rc: A precise & pristine ggplot2 theme with opinionated defaults and an emphasis on typoghraphy
+theme_ipsum: Arial Narrow
-theme_ipsum: A precise & pristine ggplot2 theme with opinionated defaults and an emphasis on typography
+theme_ipsum_gs: Goldman Sans Condensed
-theme_ipsum_ps: A precise & pristine ggplot2 theme with opinionated defaults and an emphasis on typoghraphy
+theme_ipsum_es: Econ Sans Condensed
-theme_ipsum_rc: A precise & pristine ggplot2 theme with opinionated defaults and an emphasis on typoghraphy
+theme_ipsum_rc: Roboto Condensed
-theme_ipsum_tw: A precise & pristine ggplot2 theme with opinionated defaults and an emphasis on typoghraphy
+theme_ipsum_ps: IBM Plex Sans font
-theme_modern_rc: A precise & pristine ggplot2 theme with opinionated defaults and an emphasis on typoghraphy
+theme_ipsum_pub: Public Sans
+
+theme_ipsum_tw: Titillium Web
+
+theme_modern_rc: Roboto Condensed dark theme
+
+theme_ft_rc: Dark theme based on FT’s dark theme (Roboto Condensed)
Scales (that align with various themes):
-scale_color_ft: Discrete color & fill scales based on the FT palette
-
scale_color_ipsum: Discrete color & fill scales based on the ipsum palette
-scale_colour_ft: Discrete color & fill scales based on the FT palette
-
scale_colour_ipsum: Discrete color & fill scales based on the ipsum palette
-scale_fill_ft: Discrete color & fill scales based on the FT palette
-
scale_fill_ipsum: Discrete color & fill scales based on the ipsum palette
-scale_x_comma: X & Y scales with opinionated pre-sets for percent & comma label formats
+scale_color_ft: Discrete color & fill scales based on the FT palette
+
+scale_colour_ft: Discrete color & fill scales based on the FT palette
+
+scale_fill_ft: Discrete color & fill scales based on the FT palette
+
+scale_x_comma: X & Y scales with opinionated presets for percent & comma label formats
-scale_x_percent: X & Y scales with opinionated pre-sets for percent & comma label formats
+scale_x_percent: X & Y scales with opinionated presets for percent & comma label formats
-scale_y_comma: X & Y scales with opinionated pre-sets for percent & comma label formats
+scale_y_comma: X & Y scales with opinionated presets for percent & comma label formats
-scale_y_percent: X & Y scales with opinionated pre-sets for percent & comma label formats
+scale_y_percent: X & Y scales with opinionated presets for percent & comma label formats
Palettes/Named Colors:
@@ -146,14 +153,28 @@
font_an: Arial Narrow font name R variable aliases
-font_ps: PlexSans font name R variable aliases
+font_es: Econ Sans font name R variable aliases
-font_ps_light: PlexSans font name R variable aliases
+font_es_bold: Econ Sans font name R variable aliases
+
+font_es_light: Econ Sans font name R variable aliases
font_rc: Roboto Condensed font name R variable aliases
font_rc_light: Roboto Condensed font name R variable aliases
+font_pub: Public Sans font name R variable aliases
+
+font_pub_bold: Public Sans font name R variable aliases
+
+font_pub_light: Public Sans font name R variable aliases
+
+font_pub_thin: Public Sans font name R variable aliases
+
+font_ps: PlexSans font name R variable aliases
+
+font_ps_light: PlexSans font name R variable aliases
+
font_tw: Titillium Web font name R variable aliases
font_tw_bold: Titillium Web font name R variable aliases
@@ -176,6 +197,8 @@
gg_check: Spell check ggplot2 plot labels
+import_econ_sans: Import Econ Sans Condensed font for use in charts
+
import_plex_sans: Import IBM Plex Sans font for use in charts
import_roboto_condensed: Import Roboto Condensed font for use in charts
@@ -186,184 +209,209 @@
update_geom_font_defaults: Update matching font defaults for text geoms
+install.packages("hrbrthemes")# NOTE: CRAN version is 0.8.0
+# or
+install.packages("hrbrthemes", repos =c("https://cinc.rud.is", "https://cloud.r-project.org/"))
+# or
+remotes::install_git("https://git.rud.is/hrbrmstr/hrbrthemes.git")
+# or
+remotes::install_git("https://git.sr.ht/~hrbrmstr/hrbrthemes")
+# or
+remotes::install_gitlab("hrbrmstr/hrbrthemes")
+# or
+remotes::install_bitbucket("hrbrmstr/hrbrthemes")
+# or
+remotes::install_github("hrbrmstr/hrbrthemes")
+
NOTE: To use the ‘remotes’ install options you will need to have the {remotes} package installed.
+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()
+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()
+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()
+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()
+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")
+
+
+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")
+
+
+update_geom_font_defaults(font_rc_light)
+
+count(mpg, class)%>%
+ mutate(n=n*2000)%>%
+ arrange(n)%>%
+ mutate(class=factor(class, levels=class))%>%
+ ggplot(aes(class, n))+
+ geom_col()+
+ geom_text(aes(label=scales::comma(n)), hjust=0, nudge_y=2000)+
+ scale_y_comma(limits=c(0,150000))+
+ coord_flip()+
+ 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'")+
+ theme_ipsum_rc(grid="X")
+df<-data.frame(x=c(20, 25, 30), y=c(4, 4, 4), txt=c("One", "Two", "Three"))
+
+ggplot(mtcars, aes(mpg, wt))+
+ geom_point()+
+ 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")+
+ theme_ipsum_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)
+
-
-
-hrbrthemes Metrics
-
+
+
hrbrthemes Metrics
+
+
Lang
# Files
@@ -378,62 +426,94 @@
R
-
20
-
0.91
-
1082
-
0.9
-
211
-
0.68
-
583
-
0.78
+
24
+
0.89
+
1724
+
0.80
+
327
+
0.72
+
908
+
0.84
+
HTML
+
1
+
0.04
+
297
+
0.14
+
32
+
0.07
+
2
+
0.00
+
+
Rmd
2
-
0.09
-
124
-
0.1
-
99
-
0.32
-
162
-
0.22
+
0.07
+
129
+
0.06
+
98
+
0.21
+
168
+
0.16
-
-
-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.
+
+
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.
A covenience function intended for basic, fixed-scale plots only (i.e. does not handle
-free scales in facets).
-
+
A convenience function intended for basic, fixed-scale plots only (i.e. does not handle
+free scales in facets).
You need to pass in a ggplot2 object to this function. It can't be +'d in a chain
of geoms, coords, scales, themes, etc. It also builds the plot (but does not display
-it) so if the plt takes a while (i.e. has lots of data or transforms) this will also
+it) so if the plot takes a while (i.e. has lots of data or transforms) this will also
take a while.
-
-
flush_ticks(gg, flush="XY", plot=TRUE, cat=TRUE)
-
-
Arguments
-
-
-
-
gg
-
ggplot2 plot object
-
-
-
flush
-
either "X" or "Y" or "XY" to flush individual or both axes. Default: both.
-
-
-
plot
-
if FALSE then the ggplot object will be returned invisibly
-
-
-
cat
-
if TRUE then display theme() statements and copy them to the clipboard