Browse Source

Fixes #7; Added visual diff tests; made `gg_check()` optional; Moved `hunspell` and `stringi` to `Suggests`; Fixed typos.

tags/0.8.0
boB Rudis 7 years ago
parent
commit
c1c2c3d082
No known key found for this signature in database GPG Key ID: 1D7529BE14E2BBA9
  1. 1
      .Rbuildignore
  2. 14
      DESCRIPTION
  3. 2
      NAMESPACE
  4. 12
      NEWS.md
  5. 9
      R/aaa.r
  6. 18
      R/check.r
  7. 2
      R/hrbrthemes-package.R
  8. 21
      R/roboto-condensed.r
  9. 18
      R/theme-ipsum.r
  10. 6
      README.md
  11. 12
      docs/articles/why_hrbrthemes.html
  12. 9
      man/gg_check.Rd
  13. 6
      man/theme_ipsum.Rd
  14. 8
      man/theme_ipsum_rc.Rd
  15. 3
      tests/figs/deps.txt
  16. 75
      tests/figs/themes/theme-ipsum-rc.svg
  17. 75
      tests/figs/themes/theme-ipsum.svg
  18. BIN
      tests/testthat/Rplots.pdf
  19. 13
      tests/testthat/test-themes.R
  20. 2
      vignettes/why_hrbrthemes.Rmd

1
.Rbuildignore

@ -11,3 +11,4 @@
^notes$
^cran-comments\.md$
^README_figs$
^docs$

14
DESCRIPTION

@ -1,8 +1,8 @@
Package: hrbrthemes
Type: Package
Title: Additional Themes, Theme Components and Utilities for 'ggplot2'
Version: 0.1.0
Date: 2017-02-25
Version: 0.2.0
Date: 2017-03-01
Authors@R: c(
person("Bob", "Rudis", email = "bob@rud.is", role = c("aut", "cre")),
person("Google", comment = "Roboto Condensed Font", role = c("cph"))
@ -22,7 +22,11 @@ Suggests:
knitr,
rmarkdown,
gridExtra,
gcookbook
hunspell,
stringi,
gcookbook,
vdiffr,
svglite
Depends:
R (>= 3.2.0)
Imports:
@ -30,8 +34,6 @@ Imports:
grid,
scales,
extrafont,
hunspell,
stringi,
purrr
RoxygenNote: 6.0.0
RoxygenNote: 6.0.1
VignetteBuilder: knitr

2
NAMESPACE

@ -20,9 +20,7 @@ export(update_geom_font_defaults)
import(extrafont)
import(ggplot2)
import(grid)
import(hunspell)
import(scales)
import(stringi)
importFrom(purrr,"%>%")
importFrom(purrr,map)
importFrom(purrr,walk)

12
NEWS.md

@ -1,3 +1,15 @@
# hrbrthemes 0.2.0
## Changed Stuff
* Added `vdiffr` tests for the two core themes.
* Moved `hunspell` and `stringi` to `Suggests` and added namespace tests to `gg_check()`.
* Added `dict` and `ignore` parameters (with defaults) to `gg_check()` (@karldw) [PR #3].
* Fixed typos (@benmarwick) [PR #1].
* Spelling in vignette fixed (@zx8754) [Issue #6].
* New lighter grid color default (`#cccccc`) [Issue #7].
# hrbrthemes 0.1.0
## New Stuff

9
R/aaa.r

@ -0,0 +1,9 @@
try_require <- function(package, fun) {
if (requireNamespace(package, quietly = TRUE)) {
library(package, character.only = TRUE)
return(invisible())
}
stop("Package `", package, "` required for `", fun , "`.\n", # nocov start
"Please install and try again.", call. = FALSE) # nocov end
}

18
R/check.r

@ -10,8 +10,10 @@
#'
#' @md
#' @param gg ggplot2 object
#' @param dict a dictionary object or string which can be passed to [hunspell::dictionary]
#' @param ignore character vector with additional approved words added to the dictionary
#' @param dict a dictionary object or string which can be passed to [hunspell::dictionary].
#' Defaults to `hunspell::dictionary("en_US")`
#' @param ignore character vector with additional approved words added to the dictionary.
#' Defaults to `hunspell::en_stats`
#' @return the object that was passed in
#' @export
#' @examples
@ -28,7 +30,13 @@
#' caption="This is a captien") -> gg
#'
#' gg_check(gg)
gg_check <- function(gg, dict = hunspell::dictionary("en_US"), ignore = hunspell::en_stats) {
gg_check <- function(gg, dict, ignore) {
try_require("hunspell", "hunspell")
try_require("stringi", "stri_extract_all_words")
if (missing(dict)) dict <- hunspell::dictionary("en_US")
if (missing(ignore)) ignore <- hunspell::en_stats
if (inherits(gg, "labels")) {
lbl <- gg
@ -42,9 +50,9 @@ gg_check <- function(gg, dict = hunspell::dictionary("en_US"), ignore = hunspell
purrr::walk(names(lbl), function(lab) {
words <- stri_extract_all_words(lbl[[lab]])
words <- stringi::stri_extract_all_words(lbl[[lab]])
words <- unlist(words)
words <- purrr::discard(hunspell(words, "text", dict = dict, ignore = ignore),
words <- purrr::discard(hunspell::hunspell(words, "text", dict = dict, ignore = ignore),
~length(.)==0)
if (length(words) > 0) {

2
R/hrbrthemes-package.R

@ -15,7 +15,7 @@
#' @name hrbrthemes
#' @docType package
#' @author Bob Rudis (bob@@rud.is)
#' @import ggplot2 grid scales extrafont hunspell stringi
#' @import ggplot2 grid scales extrafont
#' @importFrom purrr %>% map walk
NULL

21
R/roboto-condensed.r

@ -18,7 +18,9 @@
#' @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 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`)
#' @param axis_col axis color
#' @param axis add x or y axes? `TRUE`, `FALSE`, "`xy`"
#' @param ticks ticks if `TRUE` add ticks
#' @export
@ -62,7 +64,8 @@ theme_ipsum_rc <- function(base_family="Roboto Condensed", base_size = 11,
axis_title_family = base_family, axis_title_size = 9,
axis_title_face = "plain", axis_title_just = "rt",
plot_margin = margin(30, 30, 30, 30),
grid = TRUE, axis = FALSE, ticks = FALSE) {
grid_col = "#2b2b2b99", grid = TRUE,
axis_col = "#2b2b2b", axis = FALSE, ticks = FALSE) {
ret <- ggplot2::theme_minimal(base_family=base_family, base_size=base_size)
@ -71,9 +74,9 @@ theme_ipsum_rc <- function(base_family="Roboto Condensed", base_size = 11,
if (inherits(grid, "character") | grid == TRUE) {
ret <- ret + theme(panel.grid=element_line(color="#2b2b2bdd", size=0.10))
ret <- ret + theme(panel.grid.major=element_line(color="#2b2b2b99", size=0.10))
ret <- ret + theme(panel.grid.minor=element_line(color="#2b2b2b99", size=0.05))
ret <- ret + theme(panel.grid=element_line(color=grid_col, size=0.10))
ret <- ret + theme(panel.grid.major=element_line(color=grid_col, size=0.10))
ret <- ret + theme(panel.grid.minor=element_line(color=grid_col, size=0.05))
if (inherits(grid, "character")) {
if (regexpr("X", grid)[1] < 0) ret <- ret + theme(panel.grid.major.x=element_blank())
@ -87,22 +90,22 @@ theme_ipsum_rc <- function(base_family="Roboto Condensed", base_size = 11,
}
if (inherits(axis, "character") | axis == TRUE) {
ret <- ret + theme(axis.line=element_line(color="#2b2b2b", size=0.15))
ret <- ret + theme(axis.line=element_line(color=axis_col, size=0.15))
if (inherits(axis, "character")) {
axis <- tolower(axis)
if (regexpr("x", axis)[1] < 0) {
ret <- ret + theme(axis.line.x=element_blank())
} else {
ret <- ret + theme(axis.line.x=element_line(color="#2b2b2b", size=0.15))
ret <- ret + theme(axis.line.x=element_line(color=axis_col, size=0.15))
}
if (regexpr("y", axis)[1] < 0) {
ret <- ret + theme(axis.line.y=element_blank())
} else {
ret <- ret + theme(axis.line.y=element_line(color="#2b2b2b", size=0.15))
ret <- ret + theme(axis.line.y=element_line(color=axis_col, size=0.15))
}
} else {
ret <- ret + theme(axis.line.x=element_line(color="#2b2b2b", size=0.15))
ret <- ret + theme(axis.line.y=element_line(color="#2b2b2b", size=0.15))
ret <- ret + theme(axis.line.x=element_line(color=axis_col, size=0.15))
ret <- ret + theme(axis.line.y=element_line(color=axis_col, size=0.15))
}
} else {
ret <- ret + theme(axis.line=element_blank())

18
R/theme-ipsum.r

@ -28,6 +28,7 @@
#' @param axis_title_family,axis_title_face,axis_title_size axis title font family, face and size
#' @param axis_title_just axis title font justification, one of `[blmcrt]`
#' @param plot_margin plot margin (specify with [ggplot2::margin])
#' @param grid_col,axis_col grid & axis colors; both default to `#cccccc`
#' @param grid panel grid (`TRUE`, `FALSE`, or a combination of `X`, `x`, `Y`, `y`)
#' @param axis add x or y axes? `TRUE`, `FALSE`, "`xy`"
#' @param ticks ticks if `TRUE` add ticks
@ -72,7 +73,8 @@ theme_ipsum <- function(base_family="Arial Narrow", base_size = 11,
axis_title_family = subtitle_family, axis_title_size = 9,
axis_title_face = "plain", axis_title_just = "rt",
plot_margin = margin(30, 30, 30, 30),
grid = TRUE, axis = FALSE, ticks = FALSE) {
grid_col = "#cccccc", grid = TRUE,
axis_col = "#cccccc", axis = FALSE, ticks = FALSE) {
ret <- ggplot2::theme_minimal(base_family=base_family, base_size=base_size)
@ -81,9 +83,9 @@ theme_ipsum <- function(base_family="Arial Narrow", base_size = 11,
if (inherits(grid, "character") | grid == TRUE) {
ret <- ret + theme(panel.grid=element_line(color="#2b2b2bdd", size=0.10))
ret <- ret + theme(panel.grid.major=element_line(color="#2b2b2b99", size=0.10))
ret <- ret + theme(panel.grid.minor=element_line(color="#2b2b2b99", size=0.05))
ret <- ret + theme(panel.grid=element_line(color=grid_col, size=0.10))
ret <- ret + theme(panel.grid.major=element_line(color=grid_col, size=0.10))
ret <- ret + theme(panel.grid.minor=element_line(color=grid_col, size=0.05))
if (inherits(grid, "character")) {
if (regexpr("X", grid)[1] < 0) ret <- ret + theme(panel.grid.major.x=element_blank())
@ -103,16 +105,16 @@ theme_ipsum <- function(base_family="Arial Narrow", base_size = 11,
if (regexpr("x", axis)[1] < 0) {
ret <- ret + theme(axis.line.x=element_blank())
} else {
ret <- ret + theme(axis.line.x=element_line(color="#2b2b2b", size=0.15))
ret <- ret + theme(axis.line.x=element_line(color=axis_col, size=0.15))
}
if (regexpr("y", axis)[1] < 0) {
ret <- ret + theme(axis.line.y=element_blank())
} else {
ret <- ret + theme(axis.line.y=element_line(color="#2b2b2b", size=0.15))
ret <- ret + theme(axis.line.y=element_line(color=axis_col, size=0.15))
}
} else {
ret <- ret + theme(axis.line.x=element_line(color="#2b2b2b", size=0.15))
ret <- ret + theme(axis.line.y=element_line(color="#2b2b2b", size=0.15))
ret <- ret + theme(axis.line.x=element_line(color=axis_col, size=0.15))
ret <- ret + theme(axis.line.y=element_line(color=axis_col, size=0.15))
}
} else {
ret <- ret + theme(axis.line=element_blank())

6
README.md

@ -38,7 +38,7 @@ library(tidyverse)
# current verison
packageVersion("hrbrthemes")
## [1] '0.1.0'
## [1] '0.2.0'
```
### Base theme (Arial Narrow)
@ -166,11 +166,11 @@ library(hrbrthemes)
library(testthat)
date()
## [1] "Mon Feb 27 07:03:41 2017"
## [1] "Wed Mar 1 22:17:40 2017"
test_dir("tests/")
## testthat results ========================================================================================================
## OK: 10 SKIPPED: 0 FAILED: 0
## OK: 12 SKIPPED: 0 FAILED: 0
##
## DONE ===================================================================================================================
```

12
docs/articles/why_hrbrthemes.html

@ -45,7 +45,7 @@
<li>
<a href="http://github.com/hrbrmstr/hrbrthemes">
<span class="fa fa-github fa-lg"></span>
</a>
</li>
</ul>
@ -55,18 +55,18 @@
<!--/.container -->
</div>
<!--/.navbar -->
</header><div class="row">
<div class="col-md-9">
<div class="page-header toc-ignore">
<h1>Why hrbrthemes?</h1>
<h4 class="author">Bob Rudis</h4>
<h4 class="date">2017-02-26</h4>
</div>
<div class="contents">
<p>The <code>hrbrthemes</code> pacakge 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 <code>hrbrthemes</code> should be used.</p>
<p>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.</p>
@ -94,7 +94,7 @@
<div id="kern-what" class="section level3">
<h3 class="hasAnchor">
<html><body><a href="#kern-what" class="anchor"></a></body></html>Kern-what?</h3>
<p><a href="https://en.wikipedia.org/wiki/Kerning">Kerning</a> is nothing more than a fancy word for spaces between letters and fonts have built-in tables for how various paris 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.</p>
<p><a href="https://en.wikipedia.org/wiki/Kerning">Kerning</a> 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.</p>
<center>
<p><a href="https://www.xkcd.com/1015/"><img src="kerning.png"></a><br><a href="https://www.xkcd.com/1015/" class="uri">https://www.xkcd.com/1015/</a></p>
</center>

9
man/gg_check.Rd

@ -4,15 +4,16 @@
\alias{gg_check}
\title{Spell check ggplot2 plot labels}
\usage{
gg_check(gg, dict = hunspell::dictionary("en_US"),
ignore = hunspell::en_stats)
gg_check(gg, dict, ignore)
}
\arguments{
\item{gg}{ggplot2 object}
\item{dict}{a dictionary object or string which can be passed to \link[hunspell:dictionary]{hunspell::dictionary}}
\item{dict}{a dictionary object or string which can be passed to \link[hunspell:dictionary]{hunspell::dictionary}.
Defaults to \code{hunspell::dictionary("en_US")}}
\item{ignore}{character vector with additional approved words added to the dictionary}
\item{ignore}{character vector with additional approved words added to the dictionary.
Defaults to \code{hunspell::en_stats}}
}
\value{
the object that was passed in

6
man/theme_ipsum.Rd

@ -14,8 +14,8 @@ theme_ipsum(base_family = "Arial Narrow", base_size = 11,
caption_size = 9, caption_face = "italic", caption_margin = 10,
axis_title_family = subtitle_family, axis_title_size = 9,
axis_title_face = "plain", axis_title_just = "rt",
plot_margin = margin(30, 30, 30, 30), grid = TRUE, axis = FALSE,
ticks = FALSE)
plot_margin = margin(30, 30, 30, 30), grid_col = "#cccccc", grid = TRUE,
axis_col = "#cccccc", axis = FALSE, ticks = FALSE)
}
\arguments{
\item{base_family, base_size}{base font family and size}
@ -36,6 +36,8 @@ theme_ipsum(base_family = "Arial Narrow", base_size = 11,
\item{plot_margin}{plot margin (specify with \link[ggplot2:margin]{ggplot2::margin})}
\item{grid_col, axis_col}{grid & axis colors; both default to \code{#cccccc}}
\item{grid}{panel grid (\code{TRUE}, \code{FALSE}, or a combination of \code{X}, \code{x}, \code{Y}, \code{y})}
\item{axis}{add x or y axes? \code{TRUE}, \code{FALSE}, "\code{xy}"}

8
man/theme_ipsum_rc.Rd

@ -14,8 +14,8 @@ theme_ipsum_rc(base_family = "Roboto Condensed", base_size = 11,
caption_size = 9, caption_face = "plain", caption_margin = 10,
axis_title_family = base_family, axis_title_size = 9,
axis_title_face = "plain", axis_title_just = "rt",
plot_margin = margin(30, 30, 30, 30), grid = TRUE, axis = FALSE,
ticks = FALSE)
plot_margin = margin(30, 30, 30, 30), grid_col = "#2b2b2b99",
grid = TRUE, axis_col = "#2b2b2b", axis = FALSE, ticks = FALSE)
}
\arguments{
\item{base_family, base_size}{base font family and size}
@ -36,8 +36,12 @@ theme_ipsum_rc(base_family = "Roboto Condensed", base_size = 11,
\item{plot_margin}{plot margin (specify with \link[ggplot2:margin]{ggplot2::margin})}
\item{grid_col}{grid color}
\item{grid}{panel grid (\code{TRUE}, \code{FALSE}, or a combination of \code{X}, \code{x}, \code{Y}, \code{y})}
\item{axis_col}{axis color}
\item{axis}{add x or y axes? \code{TRUE}, \code{FALSE}, "\code{xy}"}
\item{ticks}{ticks if \code{TRUE} add ticks}

3
tests/figs/deps.txt

@ -0,0 +1,3 @@
vdiffr: 0.1.1
svglite: 1.2.0
ggplot2: 2.2.1.9000

75
tests/figs/themes/theme-ipsum-rc.svg

@ -0,0 +1,75 @@
<?xml version='1.0' encoding='UTF-8' ?>
<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 720.00 576.00'>
<defs>
<style type='text/css'><![CDATA[
line, polyline, path, rect, circle {
fill: none;
stroke: #000000;
stroke-linecap: round;
stroke-linejoin: round;
stroke-miterlimit: 10.00;
}
]]></style>
</defs>
<rect width='100%' height='100%' style='stroke: none; fill: #FFFFFF;'/>
<defs>
<clipPath id='cpNTguMjUyMXw2NDMuNTU2fDUyNS4wOHw3NC42MjI='>
<rect x='58.25' y='74.62' width='585.30' height='450.46' />
</clipPath>
</defs>
<polyline points='58.25,453.42 643.56,453.42 ' style='stroke-width: 0.11; stroke: #2B2B2B; stroke-opacity: 0.60; stroke-linecap: butt;' clip-path='url(#cpNTguMjUyMXw2NDMuNTU2fDUyNS4wOHw3NC42MjI=)' />
<polyline points='58.25,351.04 643.56,351.04 ' style='stroke-width: 0.11; stroke: #2B2B2B; stroke-opacity: 0.60; stroke-linecap: butt;' clip-path='url(#cpNTguMjUyMXw2NDMuNTU2fDUyNS4wOHw3NC42MjI=)' />
<polyline points='58.25,248.66 643.56,248.66 ' style='stroke-width: 0.11; stroke: #2B2B2B; stroke-opacity: 0.60; stroke-linecap: butt;' clip-path='url(#cpNTguMjUyMXw2NDMuNTU2fDUyNS4wOHw3NC42MjI=)' />
<polyline points='58.25,146.29 643.56,146.29 ' style='stroke-width: 0.11; stroke: #2B2B2B; stroke-opacity: 0.60; stroke-linecap: butt;' clip-path='url(#cpNTguMjUyMXw2NDMuNTU2fDUyNS4wOHw3NC42MjI=)' />
<polyline points='151.37,525.08 151.37,74.62 ' style='stroke-width: 0.11; stroke: #2B2B2B; stroke-opacity: 0.60; stroke-linecap: butt;' clip-path='url(#cpNTguMjUyMXw2NDMuNTU2fDUyNS4wOHw3NC42MjI=)' />
<polyline points='284.39,525.08 284.39,74.62 ' style='stroke-width: 0.11; stroke: #2B2B2B; stroke-opacity: 0.60; stroke-linecap: butt;' clip-path='url(#cpNTguMjUyMXw2NDMuNTU2fDUyNS4wOHw3NC42MjI=)' />
<polyline points='417.42,525.08 417.42,74.62 ' style='stroke-width: 0.11; stroke: #2B2B2B; stroke-opacity: 0.60; stroke-linecap: butt;' clip-path='url(#cpNTguMjUyMXw2NDMuNTU2fDUyNS4wOHw3NC42MjI=)' />
<polyline points='550.44,525.08 550.44,74.62 ' style='stroke-width: 0.11; stroke: #2B2B2B; stroke-opacity: 0.60; stroke-linecap: butt;' clip-path='url(#cpNTguMjUyMXw2NDMuNTU2fDUyNS4wOHw3NC42MjI=)' />
<polyline points='58.25,504.61 643.56,504.61 ' style='stroke-width: 0.21; stroke: #2B2B2B; stroke-opacity: 0.60; stroke-linecap: butt;' clip-path='url(#cpNTguMjUyMXw2NDMuNTU2fDUyNS4wOHw3NC42MjI=)' />
<polyline points='58.25,402.23 643.56,402.23 ' style='stroke-width: 0.21; stroke: #2B2B2B; stroke-opacity: 0.60; stroke-linecap: butt;' clip-path='url(#cpNTguMjUyMXw2NDMuNTU2fDUyNS4wOHw3NC42MjI=)' />
<polyline points='58.25,299.85 643.56,299.85 ' style='stroke-width: 0.21; stroke: #2B2B2B; stroke-opacity: 0.60; stroke-linecap: butt;' clip-path='url(#cpNTguMjUyMXw2NDMuNTU2fDUyNS4wOHw3NC42MjI=)' />
<polyline points='58.25,197.47 643.56,197.47 ' style='stroke-width: 0.21; stroke: #2B2B2B; stroke-opacity: 0.60; stroke-linecap: butt;' clip-path='url(#cpNTguMjUyMXw2NDMuNTU2fDUyNS4wOHw3NC42MjI=)' />
<polyline points='58.25,95.10 643.56,95.10 ' style='stroke-width: 0.21; stroke: #2B2B2B; stroke-opacity: 0.60; stroke-linecap: butt;' clip-path='url(#cpNTguMjUyMXw2NDMuNTU2fDUyNS4wOHw3NC42MjI=)' />
<polyline points='84.86,525.08 84.86,74.62 ' style='stroke-width: 0.21; stroke: #2B2B2B; stroke-opacity: 0.60; stroke-linecap: butt;' clip-path='url(#cpNTguMjUyMXw2NDMuNTU2fDUyNS4wOHw3NC42MjI=)' />
<polyline points='217.88,525.08 217.88,74.62 ' style='stroke-width: 0.21; stroke: #2B2B2B; stroke-opacity: 0.60; stroke-linecap: butt;' clip-path='url(#cpNTguMjUyMXw2NDMuNTU2fDUyNS4wOHw3NC42MjI=)' />
<polyline points='350.90,525.08 350.90,74.62 ' style='stroke-width: 0.21; stroke: #2B2B2B; stroke-opacity: 0.60; stroke-linecap: butt;' clip-path='url(#cpNTguMjUyMXw2NDMuNTU2fDUyNS4wOHw3NC42MjI=)' />
<polyline points='483.93,525.08 483.93,74.62 ' style='stroke-width: 0.21; stroke: #2B2B2B; stroke-opacity: 0.60; stroke-linecap: butt;' clip-path='url(#cpNTguMjUyMXw2NDMuNTU2fDUyNS4wOHw3NC42MjI=)' />
<polyline points='616.95,525.08 616.95,74.62 ' style='stroke-width: 0.21; stroke: #2B2B2B; stroke-opacity: 0.60; stroke-linecap: butt;' clip-path='url(#cpNTguMjUyMXw2NDMuNTU2fDUyNS4wOHw3NC42MjI=)' />
<circle cx='84.86' cy='504.61' r='1.95pt' style='stroke-width: 0.71; stroke: #F8766D; fill: #F8766D;' clip-path='url(#cpNTguMjUyMXw2NDMuNTU2fDUyNS4wOHw3NC42MjI=)' />
<circle cx='350.90' cy='299.85' r='1.95pt' style='stroke-width: 0.71; stroke: #00BFC4; fill: #00BFC4;' clip-path='url(#cpNTguMjUyMXw2NDMuNTU2fDUyNS4wOHw3NC42MjI=)' />
<circle cx='616.95' cy='95.10' r='1.95pt' style='stroke-width: 0.71; stroke: #F8766D; fill: #F8766D;' clip-path='url(#cpNTguMjUyMXw2NDMuNTU2fDUyNS4wOHw3NC42MjI=)' />
<defs>
<clipPath id='cpMHw3MjB8NTc2fDA='>
<rect x='0.00' y='0.00' width='720.00' height='576.00' />
</clipPath>
</defs>
<defs>
<clipPath id='cpNTguMjUyMXw2NDMuNTU2fDc0LjYyMnw1NS4xMzE4'>
<rect x='58.25' y='55.13' width='585.30' height='19.49' />
</clipPath>
</defs>
<g clip-path='url(#cpNTguMjUyMXw2NDMuNTU2fDc0LjYyMnw1NS4xMzE4)'><text x='58.25' y='69.14' style='font-size: 12.00px; fill: #1A1A1A; font-family: Roboto Condensed;' textLength='5.92px' lengthAdjust='spacingAndGlyphs'>1</text></g>
<defs>
<clipPath id='cpMHw3MjB8NTc2fDA='>
<rect x='0.00' y='0.00' width='720.00' height='576.00' />
</clipPath>
</defs>
<g clip-path='url(#cpMHw3MjB8NTc2fDA=)'><text x='79.23' y='534.23' style='font-size: 8.80px; fill: #4D4D4D; font-family: Roboto Condensed;' textLength='11.25px' lengthAdjust='spacingAndGlyphs'>1.0</text></g>
<g clip-path='url(#cpMHw3MjB8NTc2fDA=)'><text x='212.25' y='534.23' style='font-size: 8.80px; fill: #4D4D4D; font-family: Roboto Condensed;' textLength='11.25px' lengthAdjust='spacingAndGlyphs'>1.5</text></g>
<g clip-path='url(#cpMHw3MjB8NTc2fDA=)'><text x='345.28' y='534.23' style='font-size: 8.80px; fill: #4D4D4D; font-family: Roboto Condensed;' textLength='11.25px' lengthAdjust='spacingAndGlyphs'>2.0</text></g>
<g clip-path='url(#cpMHw3MjB8NTc2fDA=)'><text x='478.30' y='534.23' style='font-size: 8.80px; fill: #4D4D4D; font-family: Roboto Condensed;' textLength='11.25px' lengthAdjust='spacingAndGlyphs'>2.5</text></g>
<g clip-path='url(#cpMHw3MjB8NTc2fDA=)'><text x='611.32' y='534.23' style='font-size: 8.80px; fill: #4D4D4D; font-family: Roboto Condensed;' textLength='11.25px' lengthAdjust='spacingAndGlyphs'>3.0</text></g>
<g clip-path='url(#cpMHw3MjB8NTc2fDA=)'><text x='44.26' y='507.81' style='font-size: 8.80px; fill: #4D4D4D; font-family: Roboto Condensed;' textLength='11.25px' lengthAdjust='spacingAndGlyphs'>1.0</text></g>
<g clip-path='url(#cpMHw3MjB8NTc2fDA=)'><text x='44.26' y='405.43' style='font-size: 8.80px; fill: #4D4D4D; font-family: Roboto Condensed;' textLength='11.25px' lengthAdjust='spacingAndGlyphs'>1.5</text></g>
<g clip-path='url(#cpMHw3MjB8NTc2fDA=)'><text x='44.26' y='303.05' style='font-size: 8.80px; fill: #4D4D4D; font-family: Roboto Condensed;' textLength='11.25px' lengthAdjust='spacingAndGlyphs'>2.0</text></g>
<g clip-path='url(#cpMHw3MjB8NTc2fDA=)'><text x='44.26' y='200.68' style='font-size: 8.80px; fill: #4D4D4D; font-family: Roboto Condensed;' textLength='11.25px' lengthAdjust='spacingAndGlyphs'>2.5</text></g>
<g clip-path='url(#cpMHw3MjB8NTc2fDA=)'><text x='44.26' y='98.30' style='font-size: 8.80px; fill: #4D4D4D; font-family: Roboto Condensed;' textLength='11.25px' lengthAdjust='spacingAndGlyphs'>3.0</text></g>
<g clip-path='url(#cpMHw3MjB8NTc2fDA=)'><text x='639.61' y='546.11' style='font-size: 9.00px; font-family: Roboto Condensed;' textLength='3.95px' lengthAdjust='spacingAndGlyphs'>x</text></g>
<g clip-path='url(#cpMHw3MjB8NTc2fDA=)'><text transform='translate(36.29,78.37) rotate(-90)' style='font-size: 9.00px; font-family: Roboto Condensed;' textLength='3.75px' lengthAdjust='spacingAndGlyphs'>y</text></g>
<g clip-path='url(#cpMHw3MjB8NTc2fDA=)'><text x='660.56' y='284.33' style='font-size: 11.00px; font-family: Roboto Condensed;' textLength='4.83px' lengthAdjust='spacingAndGlyphs'>z</text></g>
<circle cx='669.20' cy='297.29' r='1.95pt' style='stroke-width: 0.71; stroke: #F8766D; fill: #F8766D;' clip-path='url(#cpMHw3MjB8NTc2fDA=)' />
<circle cx='669.20' cy='314.57' r='1.95pt' style='stroke-width: 0.71; stroke: #00BFC4; fill: #00BFC4;' clip-path='url(#cpMHw3MjB8NTc2fDA=)' />
<g clip-path='url(#cpMHw3MjB8NTc2fDA=)'><text x='680.00' y='300.49' style='font-size: 8.80px; font-family: Roboto Condensed;' textLength='4.31px' lengthAdjust='spacingAndGlyphs'>a</text></g>
<g clip-path='url(#cpMHw3MjB8NTc2fDA=)'><text x='680.00' y='317.77' style='font-size: 8.80px; font-family: Roboto Condensed;' textLength='4.44px' lengthAdjust='spacingAndGlyphs'>b</text></g>
<g clip-path='url(#cpMHw3MjB8NTc2fDA=)'><text x='58.25' y='42.68' style='font-size: 18.00px; font-weight: bold; font-family: Roboto Condensed;' textLength='117.44px' lengthAdjust='spacingAndGlyphs'>theme_ipsum_rc</text></g>
</svg>

After

Width:  |  Height:  |  Size: 8.7 KiB

75
tests/figs/themes/theme-ipsum.svg

@ -0,0 +1,75 @@
<?xml version='1.0' encoding='UTF-8' ?>
<svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 720.00 576.00'>
<defs>
<style type='text/css'><![CDATA[
line, polyline, path, rect, circle {
fill: none;
stroke: #000000;
stroke-linecap: round;
stroke-linejoin: round;
stroke-miterlimit: 10.00;
}
]]></style>
</defs>
<rect width='100%' height='100%' style='stroke: none; fill: #FFFFFF;'/>
<defs>
<clipPath id='cpNTcuMjkwMnw2NDMuODl8NTI1LjAxOHw3NC43Nzgy'>
<rect x='57.29' y='74.78' width='586.60' height='450.24' />
</clipPath>
</defs>
<polyline points='57.29,453.39 643.89,453.39 ' style='stroke-width: 0.11; stroke: #CCCCCC; stroke-linecap: butt;' clip-path='url(#cpNTcuMjkwMnw2NDMuODl8NTI1LjAxOHw3NC43Nzgy)' />
<polyline points='57.29,351.06 643.89,351.06 ' style='stroke-width: 0.11; stroke: #CCCCCC; stroke-linecap: butt;' clip-path='url(#cpNTcuMjkwMnw2NDMuODl8NTI1LjAxOHw3NC43Nzgy)' />
<polyline points='57.29,248.73 643.89,248.73 ' style='stroke-width: 0.11; stroke: #CCCCCC; stroke-linecap: butt;' clip-path='url(#cpNTcuMjkwMnw2NDMuODl8NTI1LjAxOHw3NC43Nzgy)' />
<polyline points='57.29,146.41 643.89,146.41 ' style='stroke-width: 0.11; stroke: #CCCCCC; stroke-linecap: butt;' clip-path='url(#cpNTcuMjkwMnw2NDMuODl8NTI1LjAxOHw3NC43Nzgy)' />
<polyline points='150.61,525.02 150.61,74.78 ' style='stroke-width: 0.11; stroke: #CCCCCC; stroke-linecap: butt;' clip-path='url(#cpNTcuMjkwMnw2NDMuODl8NTI1LjAxOHw3NC43Nzgy)' />
<polyline points='283.93,525.02 283.93,74.78 ' style='stroke-width: 0.11; stroke: #CCCCCC; stroke-linecap: butt;' clip-path='url(#cpNTcuMjkwMnw2NDMuODl8NTI1LjAxOHw3NC43Nzgy)' />
<polyline points='417.25,525.02 417.25,74.78 ' style='stroke-width: 0.11; stroke: #CCCCCC; stroke-linecap: butt;' clip-path='url(#cpNTcuMjkwMnw2NDMuODl8NTI1LjAxOHw3NC43Nzgy)' />
<polyline points='550.57,525.02 550.57,74.78 ' style='stroke-width: 0.11; stroke: #CCCCCC; stroke-linecap: butt;' clip-path='url(#cpNTcuMjkwMnw2NDMuODl8NTI1LjAxOHw3NC43Nzgy)' />
<polyline points='57.29,504.55 643.89,504.55 ' style='stroke-width: 0.21; stroke: #CCCCCC; stroke-linecap: butt;' clip-path='url(#cpNTcuMjkwMnw2NDMuODl8NTI1LjAxOHw3NC43Nzgy)' />
<polyline points='57.29,402.23 643.89,402.23 ' style='stroke-width: 0.21; stroke: #CCCCCC; stroke-linecap: butt;' clip-path='url(#cpNTcuMjkwMnw2NDMuODl8NTI1LjAxOHw3NC43Nzgy)' />
<polyline points='57.29,299.90 643.89,299.90 ' style='stroke-width: 0.21; stroke: #CCCCCC; stroke-linecap: butt;' clip-path='url(#cpNTcuMjkwMnw2NDMuODl8NTI1LjAxOHw3NC43Nzgy)' />
<polyline points='57.29,197.57 643.89,197.57 ' style='stroke-width: 0.21; stroke: #CCCCCC; stroke-linecap: butt;' clip-path='url(#cpNTcuMjkwMnw2NDMuODl8NTI1LjAxOHw3NC43Nzgy)' />
<polyline points='57.29,95.24 643.89,95.24 ' style='stroke-width: 0.21; stroke: #CCCCCC; stroke-linecap: butt;' clip-path='url(#cpNTcuMjkwMnw2NDMuODl8NTI1LjAxOHw3NC43Nzgy)' />
<polyline points='83.95,525.02 83.95,74.78 ' style='stroke-width: 0.21; stroke: #CCCCCC; stroke-linecap: butt;' clip-path='url(#cpNTcuMjkwMnw2NDMuODl8NTI1LjAxOHw3NC43Nzgy)' />
<polyline points='217.27,525.02 217.27,74.78 ' style='stroke-width: 0.21; stroke: #CCCCCC; stroke-linecap: butt;' clip-path='url(#cpNTcuMjkwMnw2NDMuODl8NTI1LjAxOHw3NC43Nzgy)' />
<polyline points='350.59,525.02 350.59,74.78 ' style='stroke-width: 0.21; stroke: #CCCCCC; stroke-linecap: butt;' clip-path='url(#cpNTcuMjkwMnw2NDMuODl8NTI1LjAxOHw3NC43Nzgy)' />
<polyline points='483.91,525.02 483.91,74.78 ' style='stroke-width: 0.21; stroke: #CCCCCC; stroke-linecap: butt;' clip-path='url(#cpNTcuMjkwMnw2NDMuODl8NTI1LjAxOHw3NC43Nzgy)' />
<polyline points='617.23,525.02 617.23,74.78 ' style='stroke-width: 0.21; stroke: #CCCCCC; stroke-linecap: butt;' clip-path='url(#cpNTcuMjkwMnw2NDMuODl8NTI1LjAxOHw3NC43Nzgy)' />
<circle cx='83.95' cy='504.55' r='1.95pt' style='stroke-width: 0.71; stroke: #F8766D; fill: #F8766D;' clip-path='url(#cpNTcuMjkwMnw2NDMuODl8NTI1LjAxOHw3NC43Nzgy)' />
<circle cx='350.59' cy='299.90' r='1.95pt' style='stroke-width: 0.71; stroke: #00BFC4; fill: #00BFC4;' clip-path='url(#cpNTcuMjkwMnw2NDMuODl8NTI1LjAxOHw3NC43Nzgy)' />
<circle cx='617.23' cy='95.24' r='1.95pt' style='stroke-width: 0.71; stroke: #F8766D; fill: #F8766D;' clip-path='url(#cpNTcuMjkwMnw2NDMuODl8NTI1LjAxOHw3NC43Nzgy)' />
<defs>
<clipPath id='cpMHw3MjB8NTc2fDA='>
<rect x='0.00' y='0.00' width='720.00' height='576.00' />
</clipPath>
</defs>
<defs>
<clipPath id='cpNTcuMjkwMnw2NDMuODl8NzQuNzc4Mnw1NS4yMjU2'>
<rect x='57.29' y='55.23' width='586.60' height='19.55' />
</clipPath>
</defs>
<g clip-path='url(#cpNTcuMjkwMnw2NDMuODl8NzQuNzc4Mnw1NS4yMjU2)'><text x='57.29' y='69.30' style='font-size: 12.00px; fill: #1A1A1A; font-family: Arial Narrow;' textLength='5.47px' lengthAdjust='spacingAndGlyphs'>1</text></g>
<defs>
<clipPath id='cpMHw3MjB8NTc2fDA='>
<rect x='0.00' y='0.00' width='720.00' height='576.00' />
</clipPath>
</defs>
<g clip-path='url(#cpMHw3MjB8NTc2fDA=)'><text x='78.82' y='534.20' style='font-size: 8.80px; fill: #4D4D4D; font-family: Arial Narrow;' textLength='10.26px' lengthAdjust='spacingAndGlyphs'>1.0</text></g>
<g clip-path='url(#cpMHw3MjB8NTc2fDA=)'><text x='212.14' y='534.20' style='font-size: 8.80px; fill: #4D4D4D; font-family: Arial Narrow;' textLength='10.26px' lengthAdjust='spacingAndGlyphs'>1.5</text></g>
<g clip-path='url(#cpMHw3MjB8NTc2fDA=)'><text x='345.46' y='534.20' style='font-size: 8.80px; fill: #4D4D4D; font-family: Arial Narrow;' textLength='10.26px' lengthAdjust='spacingAndGlyphs'>2.0</text></g>
<g clip-path='url(#cpMHw3MjB8NTc2fDA=)'><text x='478.78' y='534.20' style='font-size: 8.80px; fill: #4D4D4D; font-family: Arial Narrow;' textLength='10.26px' lengthAdjust='spacingAndGlyphs'>2.5</text></g>
<g clip-path='url(#cpMHw3MjB8NTc2fDA=)'><text x='612.10' y='534.20' style='font-size: 8.80px; fill: #4D4D4D; font-family: Arial Narrow;' textLength='10.26px' lengthAdjust='spacingAndGlyphs'>3.0</text></g>
<g clip-path='url(#cpMHw3MjB8NTc2fDA=)'><text x='44.29' y='507.77' style='font-size: 8.80px; fill: #4D4D4D; font-family: Arial Narrow;' textLength='10.26px' lengthAdjust='spacingAndGlyphs'>1.0</text></g>
<g clip-path='url(#cpMHw3MjB8NTc2fDA=)'><text x='44.29' y='405.44' style='font-size: 8.80px; fill: #4D4D4D; font-family: Arial Narrow;' textLength='10.26px' lengthAdjust='spacingAndGlyphs'>1.5</text></g>
<g clip-path='url(#cpMHw3MjB8NTc2fDA=)'><text x='44.29' y='303.12' style='font-size: 8.80px; fill: #4D4D4D; font-family: Arial Narrow;' textLength='10.26px' lengthAdjust='spacingAndGlyphs'>2.0</text></g>
<g clip-path='url(#cpMHw3MjB8NTc2fDA=)'><text x='44.29' y='200.79' style='font-size: 8.80px; fill: #4D4D4D; font-family: Arial Narrow;' textLength='10.26px' lengthAdjust='spacingAndGlyphs'>2.5</text></g>
<g clip-path='url(#cpMHw3MjB8NTc2fDA=)'><text x='44.29' y='98.46' style='font-size: 8.80px; fill: #4D4D4D; font-family: Arial Narrow;' textLength='10.26px' lengthAdjust='spacingAndGlyphs'>3.0</text></g>
<g clip-path='url(#cpMHw3MjB8NTc2fDA=)'><text x='640.20' y='546.11' style='font-size: 9.00px; font-family: Arial Narrow;' textLength='3.69px' lengthAdjust='spacingAndGlyphs'>x</text></g>
<g clip-path='url(#cpMHw3MjB8NTc2fDA=)'><text transform='translate(36.33,78.47) rotate(-90)' style='font-size: 9.00px; font-family: Arial Narrow;' textLength='3.69px' lengthAdjust='spacingAndGlyphs'>y</text></g>
<g clip-path='url(#cpMHw3MjB8NTc2fDA=)'><text x='660.90' y='284.40' style='font-size: 11.00px; font-family: Arial Narrow;' textLength='4.51px' lengthAdjust='spacingAndGlyphs'>z</text></g>
<circle cx='669.54' cy='297.36' r='1.95pt' style='stroke-width: 0.71; stroke: #F8766D; fill: #F8766D;' clip-path='url(#cpMHw3MjB8NTc2fDA=)' />
<circle cx='669.54' cy='314.64' r='1.95pt' style='stroke-width: 0.71; stroke: #00BFC4; fill: #00BFC4;' clip-path='url(#cpMHw3MjB8NTc2fDA=)' />
<g clip-path='url(#cpMHw3MjB8NTc2fDA=)'><text x='680.34' y='300.57' style='font-size: 8.80px; font-family: Arial Narrow;' textLength='4.10px' lengthAdjust='spacingAndGlyphs'>a</text></g>
<g clip-path='url(#cpMHw3MjB8NTc2fDA=)'><text x='680.34' y='317.85' style='font-size: 8.80px; font-family: Arial Narrow;' textLength='4.10px' lengthAdjust='spacingAndGlyphs'>b</text></g>
<g clip-path='url(#cpMHw3MjB8NTc2fDA=)'><text x='57.29' y='42.78' style='font-size: 18.00px; font-weight: bold; font-family: Arial Narrow;' textLength='95.15px' lengthAdjust='spacingAndGlyphs'>theme_ipsum</text></g>
</svg>

After

Width:  |  Height:  |  Size: 8.3 KiB

BIN
tests/testthat/Rplots.pdf

Binary file not shown.

13
tests/testthat/test-themes.R

@ -0,0 +1,13 @@
context("themes")
test_that("themes are correct", {
df <- data.frame(x = 1:3, y = 1:3, z = c("a", "b", "a"), a = 1)
plot <- ggplot(df, aes(x, y, colour = z)) +
geom_point() +
facet_wrap(~ a)
vdiffr::expect_doppelganger("theme_ipsum", plot + theme_ipsum())
vdiffr::expect_doppelganger("theme_ipsum_rc", plot + theme_ipsum_rc())
})

2
vignettes/why_hrbrthemes.Rmd

@ -54,7 +54,7 @@ If you work in a company, your communications department likely has a set of cor
### Kern-what?
[Kerning](https://en.wikipedia.org/wiki/Kerning) is nothing more than a fancy word for spaces between letters and fonts have built-in tables for how various paris 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.
[Kerning](https://en.wikipedia.org/wiki/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.
<center>

Loading…
Cancel
Save