diff --git a/NEWS.md b/NEWS.md index 111775a..9fd0f55 100644 --- a/NEWS.md +++ b/NEWS.md @@ -9,6 +9,7 @@ * Spelling in vignette fixed (@zx8754) [Issue #6]. * New lighter grid color default `#cccccc` [Issue #7]. * Added font auto-loading (@alexwhan) [Issue #12]. +* Made base font 0.5 pts larger # hrbrthemes 0.1.0 diff --git a/R/roboto-condensed.r b/R/roboto-condensed.r index 2cf3b9f..a722533 100644 --- a/R/roboto-condensed.r +++ b/R/roboto-condensed.r @@ -22,6 +22,7 @@ #' @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_text_size font size of axis text #' @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`) @@ -59,17 +60,18 @@ #' theme(axis.text.y=element_blank()) #' } theme_ipsum_rc <- function( - base_family="Roboto Condensed", base_size = 11, + base_family="Roboto Condensed", base_size = 11.5, plot_title_family=base_family, plot_title_size = 18, plot_title_face="bold", plot_title_margin = 10, subtitle_family=if (.Platform$OS.type == "windows") "Roboto Condensed" else "Roboto Condensed Light", - subtitle_size = 12, + subtitle_size = 13, subtitle_face = "plain", subtitle_margin = 15, strip_text_family = base_family, strip_text_size = 12, strip_text_face = "plain", caption_family=if (.Platform$OS.type == "windows") "Roboto Condensed" else "Roboto Condensed Light", caption_size = 9, caption_face = "plain", caption_margin = 10, + axis_text_size = base_size, axis_title_family = base_family, axis_title_size = 9, axis_title_face = "plain", axis_title_just = "rt", plot_margin = margin(30, 30, 30, 30), @@ -83,9 +85,9 @@ theme_ipsum_rc <- function( if (inherits(grid, "character") | grid == TRUE) { - 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)) + ret <- ret + theme(panel.grid=element_line(color=grid_col, size=0.2)) + ret <- ret + theme(panel.grid.major=element_line(color=grid_col, size=0.2)) + ret <- ret + theme(panel.grid.minor=element_line(color=grid_col, size=0.15)) if (inherits(grid, "character")) { if (regexpr("X", grid)[1] < 0) ret <- ret + theme(panel.grid.major.x=element_blank()) @@ -134,8 +136,8 @@ theme_ipsum_rc <- function( xj <- switch(tolower(substr(axis_title_just, 1, 1)), b=0, l=0, m=0.5, c=0.5, r=1, t=1) yj <- switch(tolower(substr(axis_title_just, 2, 2)), b=0, l=0, m=0.5, c=0.5, r=1, t=1) - ret <- ret + theme(axis.text.x=element_text(margin=margin(t=0))) - ret <- ret + theme(axis.text.y=element_text(margin=margin(r=0))) + ret <- ret + theme(axis.text.x=element_text(size=axis_text_size, margin=margin(t=0))) + ret <- ret + theme(axis.text.y=element_text(size=axis_text_size, margin=margin(r=0))) ret <- ret + theme(axis.title=element_text(size=axis_title_size, family=axis_title_family)) ret <- ret + theme(axis.title.x=element_text(hjust=xj, size=axis_title_size, family=axis_title_family, face=axis_title_face)) diff --git a/R/theme-ipsum.r b/R/theme-ipsum.r index 60cac9a..b66d64f 100644 --- a/R/theme-ipsum.r +++ b/R/theme-ipsum.r @@ -35,6 +35,7 @@ #' @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_text_size font size of axis text #' @param axis add x or y axes? `TRUE`, `FALSE`, "`xy`" #' @param ticks ticks if `TRUE` add ticks #' @export @@ -66,7 +67,7 @@ #' theme_ipsum(grid="Y") + #' theme(axis.text.y=element_blank()) #' } -theme_ipsum <- function(base_family="Arial Narrow", base_size = 11, +theme_ipsum <- function(base_family="Arial Narrow", base_size = 11.5, plot_title_family=base_family, plot_title_size = 18, plot_title_face="bold", plot_title_margin = 10, subtitle_family=base_family, subtitle_size = 12, @@ -75,6 +76,7 @@ theme_ipsum <- function(base_family="Arial Narrow", base_size = 11, strip_text_face = "plain", caption_family = base_family, caption_size = 9, caption_face = "italic", caption_margin = 10, + axis_text_size = base_size, axis_title_family = subtitle_family, axis_title_size = 9, axis_title_face = "plain", axis_title_just = "rt", plot_margin = margin(30, 30, 30, 30), @@ -88,9 +90,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=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)) + ret <- ret + theme(panel.grid=element_line(color=grid_col, size=0.2)) + ret <- ret + theme(panel.grid.major=element_line(color=grid_col, size=0.2)) + ret <- ret + theme(panel.grid.minor=element_line(color=grid_col, size=0.15)) if (inherits(grid, "character")) { if (regexpr("X", grid)[1] < 0) ret <- ret + theme(panel.grid.major.x=element_blank()) @@ -139,8 +141,8 @@ theme_ipsum <- function(base_family="Arial Narrow", base_size = 11, xj <- switch(tolower(substr(axis_title_just, 1, 1)), b=0, l=0, m=0.5, c=0.5, r=1, t=1) yj <- switch(tolower(substr(axis_title_just, 2, 2)), b=0, l=0, m=0.5, c=0.5, r=1, t=1) - ret <- ret + theme(axis.text.x=element_text(margin=margin(t=0))) - ret <- ret + theme(axis.text.y=element_text(margin=margin(r=0))) + ret <- ret + theme(axis.text.x=element_text(size=axis_text_size, margin=margin(t=0))) + ret <- ret + theme(axis.text.y=element_text(size=axis_text_size, margin=margin(r=0))) ret <- ret + theme(axis.title=element_text(size=axis_title_size, family=axis_title_family)) ret <- ret + theme(axis.title.x=element_text(hjust=xj, size=axis_title_size, family=axis_title_family, face=axis_title_face)) diff --git a/README.md b/README.md index 5bc3a99..ea9ccfb 100644 --- a/README.md +++ b/README.md @@ -166,13 +166,14 @@ library(hrbrthemes) library(testthat) date() -## [1] "Wed Mar 1 22:17:40 2017" +## [1] "Thu Mar 2 10:25:50 2017" test_dir("tests/") ## testthat results ======================================================================================================== ## OK: 12 SKIPPED: 0 FAILED: 0 ## ## DONE =================================================================================================================== +## You rock! ``` ### Code of Conduct diff --git a/README_figs/README-unnamed-chunk-10-1.png b/README_figs/README-unnamed-chunk-10-1.png index 146ad9b..e47e548 100644 Binary files a/README_figs/README-unnamed-chunk-10-1.png and b/README_figs/README-unnamed-chunk-10-1.png differ diff --git a/README_figs/README-unnamed-chunk-11-1.png b/README_figs/README-unnamed-chunk-11-1.png index 6a224d2..c9606ce 100644 Binary files a/README_figs/README-unnamed-chunk-11-1.png and b/README_figs/README-unnamed-chunk-11-1.png differ diff --git a/README_figs/README-unnamed-chunk-5-1.png b/README_figs/README-unnamed-chunk-5-1.png index d96b998..4e4e093 100644 Binary files a/README_figs/README-unnamed-chunk-5-1.png and b/README_figs/README-unnamed-chunk-5-1.png differ diff --git a/README_figs/README-unnamed-chunk-6-1.png b/README_figs/README-unnamed-chunk-6-1.png index d7cd7a9..ab4c20f 100644 Binary files a/README_figs/README-unnamed-chunk-6-1.png and b/README_figs/README-unnamed-chunk-6-1.png differ diff --git a/README_figs/README-unnamed-chunk-7-1.png b/README_figs/README-unnamed-chunk-7-1.png index 8c0aec8..f3d4743 100644 Binary files a/README_figs/README-unnamed-chunk-7-1.png and b/README_figs/README-unnamed-chunk-7-1.png differ diff --git a/README_figs/README-unnamed-chunk-8-1.png b/README_figs/README-unnamed-chunk-8-1.png index 5fc5ea3..b29b38c 100644 Binary files a/README_figs/README-unnamed-chunk-8-1.png and b/README_figs/README-unnamed-chunk-8-1.png differ diff --git a/README_figs/README-unnamed-chunk-9-1.png b/README_figs/README-unnamed-chunk-9-1.png index 5c38b44..e06b4cd 100644 Binary files a/README_figs/README-unnamed-chunk-9-1.png and b/README_figs/README-unnamed-chunk-9-1.png differ diff --git a/man/theme_ipsum.Rd b/man/theme_ipsum.Rd index fe3dd82..407a8ca 100644 --- a/man/theme_ipsum.Rd +++ b/man/theme_ipsum.Rd @@ -12,8 +12,8 @@ theme_ipsum(base_family = "Arial Narrow", base_size = 11, strip_text_family = base_family, strip_text_size = 12, strip_text_face = "plain", caption_family = base_family, 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", + axis_text_size = base_size, 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_col = "#cccccc", grid = TRUE, axis_col = "#cccccc", axis = FALSE, ticks = FALSE) } @@ -30,6 +30,8 @@ theme_ipsum(base_family = "Arial Narrow", base_size = 11, \item{caption_family, caption_face, caption_size, caption_margin}{plot caption family, face, size and margin} +\item{axis_text_size}{font size of axis text} + \item{axis_title_family, axis_title_face, axis_title_size}{axis title font family, face and size} \item{axis_title_just}{axis title font justification, one of \code{[blmcrt]}} diff --git a/man/theme_ipsum_rc.Rd b/man/theme_ipsum_rc.Rd index 47f263a..6b719cc 100644 --- a/man/theme_ipsum_rc.Rd +++ b/man/theme_ipsum_rc.Rd @@ -4,17 +4,18 @@ \alias{theme_ipsum_rc} \title{A precise & pristine \link{ggplot2} theme with opinionated defaults and an emphasis on typoghraphy} \usage{ -theme_ipsum_rc(base_family = "Roboto Condensed", base_size = 11, +theme_ipsum_rc(base_family = "Roboto Condensed", base_size = 12, plot_title_family = base_family, plot_title_size = 18, plot_title_face = "bold", plot_title_margin = 10, subtitle_family = if (.Platform$OS.type == "windows") "Roboto Condensed" else - "Roboto Condensed Light", subtitle_size = 12, subtitle_face = "plain", + "Roboto Condensed Light", subtitle_size = 13, subtitle_face = "plain", subtitle_margin = 15, strip_text_family = base_family, strip_text_size = 12, strip_text_face = "plain", caption_family = if (.Platform$OS.type == "windows") "Roboto Condensed" else "Roboto Condensed Light", 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", + caption_margin = 10, axis_text_size = base_size, + 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_col = "#cccccc", grid = TRUE, axis_col = "#cccccc", axis = FALSE, ticks = FALSE) } @@ -31,6 +32,8 @@ theme_ipsum_rc(base_family = "Roboto Condensed", base_size = 11, \item{caption_family, caption_face, caption_size, caption_margin}{plot caption family, face, size and margin} +\item{axis_text_size}{font size of axis text} + \item{axis_title_family, axis_title_face, axis_title_size}{axis title font family, face and size} \item{axis_title_just}{axis title font justificationk one of \code{[blmcrt]}} diff --git a/tests/figs/themes/theme-ipsum-rc.svg b/tests/figs/themes/theme-ipsum-rc.svg index d235130..ec62962 100644 --- a/tests/figs/themes/theme-ipsum-rc.svg +++ b/tests/figs/themes/theme-ipsum-rc.svg @@ -13,63 +13,63 @@ - - + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - + + -1 +1 -1.0 -1.5 -2.0 -2.5 -3.0 -1.0 -1.5 -2.0 -2.5 -3.0 +1.0 +1.5 +2.0 +2.5 +3.0 +1.0 +1.5 +2.0 +2.5 +3.0 x -y -z - - -a -b -theme_ipsum_rc +y +z + + +a +b +theme_ipsum_rc diff --git a/tests/figs/themes/theme-ipsum.svg b/tests/figs/themes/theme-ipsum.svg index 4fe4ae9..ef1c138 100644 --- a/tests/figs/themes/theme-ipsum.svg +++ b/tests/figs/themes/theme-ipsum.svg @@ -13,63 +13,63 @@ - - + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - + + -1 +1 -1.0 -1.5 -2.0 -2.5 -3.0 -1.0 -1.5 -2.0 -2.5 -3.0 +1.0 +1.5 +2.0 +2.5 +3.0 +1.0 +1.5 +2.0 +2.5 +3.0 x -y -z - - -a -b -theme_ipsum +y +z + + +a +b +theme_ipsum