boB Rudis
5 years ago
29 changed files with 672 additions and 18 deletions
@ -1,18 +1,30 @@ |
|||
Package: ggexpanse |
|||
Type: Package |
|||
Title: ggexpanse title goes here otherwise CRAN checks fail |
|||
Title: Theme Elements Based On 'The Expanse' |
|||
Version: 0.1.0 |
|||
Date: 2019-08-19 |
|||
Authors@R: c( person("Bob", "Rudis", email = "bob@rud.is", role = |
|||
c("aut", "cre"), comment = c(ORCID = "0000-0001-5670-2640")) ) |
|||
Authors@R: c( |
|||
person("Bob", "Rudis", email = "bob@rud.is", |
|||
role = c("aut", "cre"), comment = c(ORCID = "0000-0001-5670-2640")), |
|||
person("domain101", "", role = "ctb", |
|||
comment = "<https://www.reddit.com/r/TheExpanse/comments/ay322l/protomolecule_font/>") |
|||
) |
|||
Maintainer: Bob Rudis <bob@rud.is> |
|||
Description: A good description goes here otherwise CRAN checks fail. |
|||
Description: Plot aesthetic defaults and theme elements inspired by 'The Expanse'. |
|||
URL: https://gitlab.com/hrbrmstr/ggexpanse |
|||
BugReports: https://gitlab.com/hrbrmstr/ggexpanse/issues |
|||
Encoding: UTF-8 |
|||
License: AGPL |
|||
Suggests: covr, tinytest |
|||
Depends: R (>= 3.2.0) |
|||
Imports: httr, jsonlite |
|||
License: MIT + file LICENSE |
|||
Suggests: |
|||
tinytest, covr |
|||
Depends: |
|||
R (>= 3.2.0), |
|||
ggplot2 (>= 2.2.1) |
|||
Imports: |
|||
grDevices, |
|||
grid, |
|||
scales, |
|||
extrafont, |
|||
tools |
|||
Roxygen: list(markdown = TRUE) |
|||
RoxygenNote: 6.1.1 |
|||
|
@ -0,0 +1,2 @@ |
|||
YEAR: 2019 |
|||
COPYRIGHT HOLDER: Bob Rudis |
@ -0,0 +1,21 @@ |
|||
# MIT License |
|||
|
|||
Copyright (c) 2019 Bob Rudis |
|||
|
|||
Permission is hereby granted, free of charge, to any person obtaining a copy |
|||
of this software and associated documentation files (the "Software"), to deal |
|||
in the Software without restriction, including without limitation the rights |
|||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|||
copies of the Software, and to permit persons to whom the Software is |
|||
furnished to do so, subject to the following conditions: |
|||
|
|||
The above copyright notice and this permission notice shall be included in all |
|||
copies or substantial portions of the Software. |
|||
|
|||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
|||
SOFTWARE. |
@ -1,4 +1,16 @@ |
|||
# Generated by roxygen2: do not edit by hand |
|||
|
|||
import(httr) |
|||
importFrom(jsonlite,fromJSON) |
|||
export(expanse_cols) |
|||
export(expanse_pal) |
|||
export(expanse_palette) |
|||
export(import_protomolecule) |
|||
export(scale_color_expanse) |
|||
export(scale_colour_expanse) |
|||
export(scale_fill_expanse) |
|||
export(theme_expanse) |
|||
import(extrafont) |
|||
import(ggplot2) |
|||
import(grDevices) |
|||
import(grid) |
|||
import(scales) |
|||
importFrom(tools,file_path_sans_ext) |
|||
|
@ -0,0 +1,53 @@ |
|||
#' Colors from The Expanse (WIP) |
|||
#' |
|||
#' @export |
|||
list( |
|||
mcrn_yellow = "#f9d366", |
|||
mcrn_red_1 = "#a45133", |
|||
mcrn_red_2 = "#6d3621", |
|||
mcrn_red_3 = "#371a11", |
|||
un_blue = "#6592df", |
|||
pk_yellow = "#d1a94d", |
|||
pk_green = "#4c7648", |
|||
tycho_red = "#d1362a", |
|||
star_helix_blue = "#12223e", |
|||
display_blue = "#7fb7ca", |
|||
gate_violet = "#602162", |
|||
white = "#ffffff", |
|||
warning = "#4c0f11", |
|||
background = "#05070b" |
|||
) -> expanse_cols |
|||
|
|||
#' @rdname expanse_cols |
|||
#' @export |
|||
c( |
|||
expanse_cols$mcrn_yellow, |
|||
expanse_cols$mcrn_red_1, |
|||
expanse_cols$un_blue, |
|||
expanse_cols$pk_green, |
|||
expanse_cols$gate_violet, |
|||
expanse_cols$white |
|||
) -> expanse_palette |
|||
|
|||
#' Color palette based on selected colors from [expanse_cols] |
|||
#' |
|||
#' @export |
|||
expanse_pal <- function() { scales::manual_pal(expanse_palette) } |
|||
|
|||
#' Discrete color & fill scales based on "The Expanse" palette |
|||
#' |
|||
#' See [expanse_pal](). |
|||
#' |
|||
#' @md |
|||
#' @inheritDotParams ggplot2::discrete_scale -expand -position |
|||
#' @rdname scale_expanse |
|||
#' @export |
|||
scale_colour_expanse <- function(...) { discrete_scale("colour", "expanse", expanse_pal(), ...) } |
|||
|
|||
#' @export |
|||
#' @rdname scale_expanse |
|||
scale_color_expanse <- scale_colour_expanse |
|||
|
|||
#' @export |
|||
#' @rdname scale_expanse |
|||
scale_fill_expanse <- function(...) { discrete_scale("fill", "expanse", expanse_pal(), ...) } |
@ -1,9 +1,10 @@ |
|||
#' ... |
|||
#' |
|||
#' Theme Elements Based On 'The Expanse' |
|||
#' |
|||
#' Plot aesthetic defaults and theme elements inspired by 'The Expanse'. |
|||
#' @md |
|||
#' @name ggexpanse |
|||
#' @keywords internal |
|||
#' @author Bob Rudis (bob@@rud.is) |
|||
#' @import httr |
|||
#' @importFrom jsonlite fromJSON |
|||
#' @import ggplot2 grid scales extrafont grDevices |
|||
#' @importFrom tools file_path_sans_ext |
|||
"_PACKAGE" |
|||
|
@ -0,0 +1,29 @@ |
|||
#' Import Protomolecule font for use in charts |
|||
#' |
|||
#' Roboto Condensed is a trademark of Google. |
|||
#' |
|||
#' There is an option `hrbrthemes.loadfonts` which -- if set to `TRUE` -- will |
|||
#' call `extrafont::loadfonts()` to register non-core fonts with R PDF & PostScript |
|||
#' devices. If you are running under Windows, the package calls the same function |
|||
#' to register non-core fonts with the Windows graphics device. |
|||
#' |
|||
#' @md |
|||
#' @note This will take care of ensuring PDF/PostScript usage. The location of the |
|||
#' font directory is displayed after the base import is complete. It is highly |
|||
#' recommended that you install them on your system the same way you would any |
|||
#' other font you wish to use in other programs. |
|||
#' @export |
|||
import_protomolecule <- function() { |
|||
|
|||
exp_font_dir <- system.file("fonts", "protomolecule", package="ggexpanse") |
|||
|
|||
suppressWarnings(suppressMessages(extrafont::font_import(exp_font_dir, prompt=FALSE))) |
|||
|
|||
message( |
|||
sprintf( |
|||
"You will likely need to install these fonts on your system as well.\n\nYou can find them in [%s]", |
|||
exp_font_dir |
|||
) |
|||
) |
|||
|
|||
} |
@ -0,0 +1,180 @@ |
|||
#' An "Expanse" theme for {ggplot2} |
|||
#' |
|||
#' You should [import_protomolecule]() first and also install the fonts on your |
|||
#' system before trying to use this theme. |
|||
#' |
|||
#' There is an option `hrbrthemes.loadfonts` which -- if set to `TRUE` -- will |
|||
#' call `extrafont::loadfonts()` to register non-core fonts with R PDF & PostScript |
|||
#' devices. If you are running under Windows, the package calls the same function |
|||
#' to register non-core fonts with the Windows graphics device. |
|||
#' |
|||
#' @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_title_col plot tilte family, face, size, margin, and color |
|||
#' @param subtitle_family,subtitle_face,subtitle_size,subtitle_col plot subtitle family, face, size, and color |
|||
#' @param subtitle_margin plot subtitle margin bottom (single numeric value) |
|||
#' @param strip_text_family,strip_text_face,strip_text_size,strip_text_col facet label font family, face and size |
|||
#' @param caption_family,caption_face,caption_size,caption_margin,caption_col 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 panel_spacing panel spacing (use `unit()`) |
|||
#' @param grid_col grid color |
|||
#' @param grid panel grid (`TRUE`, `FALSE`, or a combination of `X`, `x`, `Y`, `y`) |
|||
#' @param text_col,axis_col,background_col,foreground_col more colors to set |
|||
#' @param axis add x or y axes? `TRUE`, `FALSE`, "`xy`" |
|||
#' @param ticks ticks if `TRUE` add ticks |
|||
#' @export |
|||
theme_expanse <- function(base_family = "Protomolecule-Light", |
|||
base_size = 11.5, |
|||
plot_title_family = "Protomolecule-Medium", |
|||
plot_title_size = 18, |
|||
plot_title_face = "plain", |
|||
plot_title_margin = 10, |
|||
plot_title_col = expanse_cols$white, |
|||
subtitle_family = "Protomolecule-Light", |
|||
subtitle_size = 13, |
|||
subtitle_face = "plain", |
|||
subtitle_col = expanse_cols$mcrn_red_1, |
|||
subtitle_margin = 15, |
|||
strip_text_family = base_family, |
|||
strip_text_size = 12, |
|||
strip_text_face = "plain", |
|||
strip_text_col = expanse_cols$white, |
|||
caption_family = "Protomolecule-Light", |
|||
caption_size = 9, |
|||
caption_face = "plain", |
|||
caption_margin = 10, |
|||
caption_col = expanse_cols$white, |
|||
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), |
|||
panel_spacing = grid::unit(2, "lines"), |
|||
text_col = expanse_cols$white, |
|||
grid_col = alpha(expanse_cols$white, 1/2), |
|||
axis_col = grid_col, |
|||
background_col = expanse_cols$background, |
|||
foreground_col = expanse_cols$display_blue, |
|||
grid = TRUE, axis = FALSE, ticks = FALSE) { |
|||
|
|||
|
|||
ggplot2::update_geom_defaults("point", list(colour = foreground_col)) |
|||
ggplot2::update_geom_defaults("line", list(colour = foreground_col)) |
|||
ggplot2::update_geom_defaults("area", list(colour = foreground_col, fill = foreground_col)) |
|||
ggplot2::update_geom_defaults("rect", list(colour = foreground_col, fill = foreground_col)) |
|||
ggplot2::update_geom_defaults("density", list(colour = foreground_col, fill = foreground_col)) |
|||
ggplot2::update_geom_defaults("bar", list(colour = foreground_col, fill = foreground_col)) |
|||
ggplot2::update_geom_defaults("col", list(colour = foreground_col, fill = foreground_col)) |
|||
ggplot2::update_geom_defaults("text", list(colour = expanse_cols$white)) |
|||
|
|||
ret <- ggplot2::theme_minimal(base_family = base_family, base_size = base_size) |
|||
|
|||
ret <- ret + theme(legend.background = element_blank()) |
|||
ret <- ret + theme(legend.key = element_blank()) |
|||
|
|||
if (inherits(grid, "character") | grid == TRUE) { |
|||
ret <- ret + theme(panel.grid = element_line(color = grid_col, size = 0.175)) |
|||
ret <- ret + theme(panel.grid.major = element_line(color = grid_col, size = 0.175)) |
|||
ret <- ret + theme(panel.grid.minor = element_line(color = grid_col, size = 0.125)) |
|||
|
|||
if (inherits(grid, "character")) { |
|||
if (regexpr("X", grid)[1] < 0) ret <- ret + theme(panel.grid.major.x = element_blank()) |
|||
if (regexpr("Y", grid)[1] < 0) ret <- ret + theme(panel.grid.major.y = element_blank()) |
|||
if (regexpr("x", grid)[1] < 0) ret <- ret + theme(panel.grid.minor.x = element_blank()) |
|||
if (regexpr("y", grid)[1] < 0) ret <- ret + theme(panel.grid.minor.y = element_blank()) |
|||
} |
|||
} else { |
|||
ret <- ret + theme(panel.grid = element_blank()) |
|||
} |
|||
|
|||
if (inherits(axis, "character") | axis == TRUE) { |
|||
ret <- ret + theme(axis.line = element_line(color = "white", 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 = 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 = axis_col, size = 0.15)) |
|||
} |
|||
} else { |
|||
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()) |
|||
} |
|||
|
|||
if (!ticks) { |
|||
ret <- ret + theme(axis.ticks = element_blank()) |
|||
ret <- ret + theme(axis.ticks.x = element_blank()) |
|||
ret <- ret + theme(axis.ticks.y = element_blank()) |
|||
} else { |
|||
ret <- ret + theme(axis.ticks = element_line(size = 0.15)) |
|||
ret <- ret + theme(axis.ticks.x = element_line(size = 0.15)) |
|||
ret <- ret + theme(axis.ticks.y = element_line(size = 0.15)) |
|||
ret <- ret + theme(axis.ticks.length = grid::unit(5, "pt")) |
|||
} |
|||
|
|||
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(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 |
|||
)) |
|||
ret <- ret + theme(axis.title.y = element_text( |
|||
hjust = yj, size = axis_title_size, |
|||
family = axis_title_family, face = axis_title_face |
|||
)) |
|||
ret <- ret + theme(strip.text = element_text( |
|||
hjust = 0, size = strip_text_size, |
|||
color = strip_text_col, |
|||
face = strip_text_face, family = strip_text_family |
|||
)) |
|||
ret <- ret + theme(panel.spacing = panel_spacing) |
|||
ret <- ret + theme(plot.title = element_text( |
|||
hjust = 0, size = plot_title_size, |
|||
margin = margin(b = plot_title_margin), |
|||
family = plot_title_family, face = plot_title_face |
|||
)) |
|||
ret <- ret + theme(plot.subtitle = element_text( |
|||
hjust = 0, size = subtitle_size, |
|||
color = subtitle_col, |
|||
margin = margin(b = subtitle_margin), |
|||
family = subtitle_family, face = subtitle_face |
|||
)) |
|||
ret <- ret + theme(plot.caption = element_text( |
|||
hjust = 1, size = caption_size, |
|||
margin = margin(t = caption_margin), |
|||
family = caption_family, face = caption_face |
|||
)) |
|||
ret <- ret + theme(plot.margin = plot_margin) |
|||
|
|||
ret <- ret + |
|||
theme(plot.background = element_rect(fill = background_col, color = background_col)) + |
|||
theme(panel.background = element_rect(fill = background_col, color = background_col)) + |
|||
theme(rect = element_rect(fill = background_col, color = background_col)) + |
|||
theme(text = element_text(color = text_col)) + |
|||
theme(axis.text = element_text(color = text_col)) + |
|||
theme(title = element_text(color = text_col)) + |
|||
theme(plot.title = element_text(color = plot_title_col)) + |
|||
theme(plot.subtitle = element_text(color = subtitle_col)) + |
|||
theme(plot.caption = element_text(color = caption_col)) + |
|||
theme(line = element_line(color = foreground_col)) + |
|||
theme(axis.ticks = element_line(color = grid_col)) |
|||
|
|||
ret |
|||
|
|||
} |
@ -0,0 +1,22 @@ |
|||
.onAttach <- function(libname, pkgname) { |
|||
|
|||
if (.Platform$OS.type == "windows") { # nocov start |
|||
if (interactive()) packageStartupMessage("Registering Windows fonts with R") |
|||
extrafont::loadfonts("win", quiet = TRUE) |
|||
} |
|||
|
|||
if (getOption("hrbrthemes.loadfonts", default = FALSE)) { |
|||
if (interactive()) packageStartupMessage("Registering PDF & PostScript fonts with R") |
|||
extrafont::loadfonts("pdf", quiet = TRUE) |
|||
extrafont::loadfonts("postscript", quiet = TRUE) |
|||
} |
|||
|
|||
fnt <- extrafont::fonttable() |
|||
if (!any(grepl("otomole", fnt$FamilyName))) { |
|||
packageStartupMessage( |
|||
"NOTE: The 'Protomolecule' font is required to use this theme.\n", |
|||
" Please use hrbrthemes::import_protomolecule() to install it." |
|||
) |
|||
} # nocov end |
|||
|
|||
} |
@ -0,0 +1,106 @@ |
|||
|
|||
[![Project Status: Active – The project has reached a stable, usable |
|||
state and is being actively |
|||
developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active) |
|||
[![Signed |
|||
by](https://img.shields.io/badge/Keybase-Verified-brightgreen.svg)](https://keybase.io/hrbrmstr) |
|||
![Signed commit |
|||
%](https://img.shields.io/badge/Signed_Commits-100%25-lightgrey.svg) |
|||
[![Linux build |
|||
Status](https://travis-ci.org/hrbrmstr/ggexpanse.svg?branch=master)](https://travis-ci.org/hrbrmstr/ggexpanse) |
|||
![Minimal R |
|||
Version](https://img.shields.io/badge/R%3E%3D-3.2.0-blue.svg) |
|||
![License](https://img.shields.io/badge/License-MIT-blue.svg) |
|||
|
|||
# ggexpanse |
|||
|
|||
Theme Elements Based On ‘The Expanse’ |
|||
|
|||
## Description |
|||
|
|||
Plot aesthetic defaults and theme elements inspired by ‘The Expanse’. |
|||
|
|||
## What’s Inside The Tin |
|||
|
|||
The following functions are implemented: |
|||
|
|||
- `expanse_cols`: Colors from The Expanse (WIP) |
|||
- `expanse_pal`: Color palette based on selected colors from |
|||
expanse\_cols |
|||
- `import_protomolecule`: Import Protomolecule font for use in charts |
|||
- `scale_colour_expanse`: Discrete color & fill scales based on “The |
|||
Expanse” palette |
|||
- `theme_expanse`: An “Expanse” theme for ggplot2 |
|||
|
|||
## Installation |
|||
|
|||
``` r |
|||
remotes::install_git("https://git.rud.is/hrbrmstr/ggexpanse.git") |
|||
# or |
|||
remotes::install_git("https://git.sr.ht/~hrbrmstr/ggexpanse") |
|||
# or |
|||
remotes::install_gitlab("hrbrmstr/ggexpanse") |
|||
# or |
|||
remotes::install_bitbucket("hrbrmstr/ggexpanse") |
|||
``` |
|||
|
|||
NOTE: To use the ‘remotes’ install options you will need to have the |
|||
[{remotes} package](https://github.com/r-lib/remotes) installed. |
|||
|
|||
## Usage |
|||
|
|||
``` r |
|||
library(ggexpanse) |
|||
|
|||
# current version |
|||
packageVersion("ggexpanse") |
|||
## [1] '0.1.0' |
|||
``` |
|||
|
|||
``` r |
|||
scales::show_col(as.character(expanse_cols)) |
|||
``` |
|||
|
|||
<img src="man/figures/README-pal1-1.png" width="672" /> |
|||
|
|||
``` r |
|||
scales::show_col(expanse_palette) |
|||
``` |
|||
|
|||
<img src="man/figures/README-pal2-1.png" width="672" /> |
|||
|
|||
``` r |
|||
ggplot() + |
|||
geom_smooth( |
|||
data = mtcars, method = "lm", |
|||
aes(wt, mpg), colour = "white", |
|||
fill = "gray60", show.legend = FALSE |
|||
) + |
|||
geom_point( |
|||
data = mtcars, |
|||
aes(wt, mpg, fill = factor(carb)), |
|||
shape = 21, color = "gray60", size = 4 |
|||
) + |
|||
scale_colour_expanse() + |
|||
scale_fill_expanse() + |
|||
labs( |
|||
title = "Stars Are Better_Off Without Us", |
|||
subtitle = "Say what you_will about organized_crime, at least it’s organized." |
|||
) + |
|||
theme_expanse(grid = "XY") |
|||
``` |
|||
|
|||
<img src="man/figures/README-plotex-1.png" width="768" /> |
|||
|
|||
## ggexpanse Metrics |
|||
|
|||
| Lang | \# Files | (%) | LoC | (%) | Blank lines | (%) | \# Lines | (%) | |
|||
| :--- | -------: | ---: | --: | ---: | ----------: | ---: | -------: | ---: | |
|||
| R | 6 | 0.86 | 198 | 0.88 | 28 | 0.61 | 72 | 0.69 | |
|||
| Rmd | 1 | 0.14 | 28 | 0.12 | 18 | 0.39 | 33 | 0.31 | |
|||
|
|||
## 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. |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,17 @@ |
|||
% Generated by roxygen2: do not edit by hand |
|||
% Please edit documentation in R/colors.R |
|||
\docType{data} |
|||
\name{expanse_cols} |
|||
\alias{expanse_cols} |
|||
\alias{expanse_palette} |
|||
\title{Colors from The Expanse (WIP)} |
|||
\format{An object of class \code{list} of length 14.} |
|||
\usage{ |
|||
expanse_cols |
|||
|
|||
expanse_palette |
|||
} |
|||
\description{ |
|||
Colors from The Expanse (WIP) |
|||
} |
|||
\keyword{datasets} |
@ -0,0 +1,11 @@ |
|||
% Generated by roxygen2: do not edit by hand |
|||
% Please edit documentation in R/colors.R |
|||
\name{expanse_pal} |
|||
\alias{expanse_pal} |
|||
\title{Color palette based on selected colors from \link{expanse_cols}} |
|||
\usage{ |
|||
expanse_pal() |
|||
} |
|||
\description{ |
|||
Color palette based on selected colors from \link{expanse_cols} |
|||
} |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 35 KiB |
@ -0,0 +1,23 @@ |
|||
% Generated by roxygen2: do not edit by hand |
|||
% Please edit documentation in R/protomolecule.R |
|||
\name{import_protomolecule} |
|||
\alias{import_protomolecule} |
|||
\title{Import Protomolecule font for use in charts} |
|||
\usage{ |
|||
import_protomolecule() |
|||
} |
|||
\description{ |
|||
Roboto Condensed is a trademark of Google. |
|||
} |
|||
\details{ |
|||
There is an option \code{hrbrthemes.loadfonts} which -- if set to \code{TRUE} -- will |
|||
call \code{extrafont::loadfonts()} to register non-core fonts with R PDF & PostScript |
|||
devices. If you are running under Windows, the package calls the same function |
|||
to register non-core fonts with the Windows graphics device. |
|||
} |
|||
\note{ |
|||
This will take care of ensuring PDF/PostScript usage. The location of the |
|||
font directory is displayed after the base import is complete. It is highly |
|||
recommended that you install them on your system the same way you would any |
|||
other font you wish to use in other programs. |
|||
} |
@ -0,0 +1,63 @@ |
|||
% Generated by roxygen2: do not edit by hand |
|||
% Please edit documentation in R/colors.R |
|||
\name{scale_colour_expanse} |
|||
\alias{scale_colour_expanse} |
|||
\alias{scale_color_expanse} |
|||
\alias{scale_fill_expanse} |
|||
\title{Discrete color & fill scales based on "The Expanse" palette} |
|||
\usage{ |
|||
scale_colour_expanse(...) |
|||
|
|||
scale_color_expanse(...) |
|||
|
|||
scale_fill_expanse(...) |
|||
} |
|||
\arguments{ |
|||
\item{...}{Arguments passed on to \code{ggplot2::discrete_scale} |
|||
\describe{ |
|||
\item{aesthetics}{The names of the aesthetics that this scale works with} |
|||
\item{scale_name}{The name of the scale} |
|||
\item{palette}{A palette function that when called with a single integer |
|||
argument (the number of levels in the scale) returns the values that |
|||
they should take.} |
|||
\item{name}{The name of the scale. Used as the axis or legend title. If |
|||
\code{waiver()}, the default, the name of the scale is taken from the first |
|||
mapping used for that aesthetic. If \code{NULL}, the legend title will be |
|||
omitted.} |
|||
\item{breaks}{One of: |
|||
\itemize{ |
|||
\item \code{NULL} for no breaks |
|||
\item \code{waiver()} for the default breaks computed by the |
|||
transformation object |
|||
\item A character vector of breaks |
|||
\item A function that takes the limits as input and returns breaks |
|||
as output |
|||
}} |
|||
\item{labels}{One of: |
|||
\itemize{ |
|||
\item \code{NULL} for no labels |
|||
\item \code{waiver()} for the default labels computed by the |
|||
transformation object |
|||
\item A character vector giving labels (must be same length as \code{breaks}) |
|||
\item A function that takes the breaks as input and returns labels |
|||
as output |
|||
}} |
|||
\item{limits}{A character vector that defines possible values of the scale |
|||
and their order.} |
|||
\item{na.translate}{Unlike continuous scales, discrete scales can easily show |
|||
missing values, and do so by default. If you want to remove missing values |
|||
from a discrete scale, specify \code{na.translate = FALSE}.} |
|||
\item{na.value}{If \code{na.translate = TRUE}, what value aesthetic |
|||
value should missing be displayed as? Does not apply to position scales |
|||
where \code{NA} is always placed at the far right.} |
|||
\item{drop}{Should unused factor levels be omitted from the scale? |
|||
The default, \code{TRUE}, uses the levels that appear in the data; |
|||
\code{FALSE} uses all the levels in the factor.} |
|||
\item{guide}{A function used to create a guide or its name. See |
|||
\code{\link[=guides]{guides()}} for more info.} |
|||
\item{super}{The super class to use for the constructed scale} |
|||
}} |
|||
} |
|||
\description{ |
|||
See \url{expanse_pal}. |
|||
} |
@ -0,0 +1,70 @@ |
|||
% Generated by roxygen2: do not edit by hand |
|||
% Please edit documentation in R/theme-expanse.R |
|||
\name{theme_expanse} |
|||
\alias{theme_expanse} |
|||
\title{An "Expanse" theme for {ggplot2}} |
|||
\usage{ |
|||
theme_expanse(base_family = "Protomolecule-Light", base_size = 11.5, |
|||
plot_title_family = "Protomolecule-Medium", plot_title_size = 18, |
|||
plot_title_face = "plain", plot_title_margin = 10, |
|||
plot_title_col = expanse_cols$white, |
|||
subtitle_family = "Protomolecule-Light", subtitle_size = 13, |
|||
subtitle_face = "plain", subtitle_col = expanse_cols$mcrn_red_1, |
|||
subtitle_margin = 15, strip_text_family = base_family, |
|||
strip_text_size = 12, strip_text_face = "plain", |
|||
strip_text_col = expanse_cols$white, |
|||
caption_family = "Protomolecule-Light", caption_size = 9, |
|||
caption_face = "plain", caption_margin = 10, |
|||
caption_col = expanse_cols$white, 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), panel_spacing = grid::unit(2, |
|||
"lines"), text_col = expanse_cols$white, |
|||
grid_col = alpha(expanse_cols$white, 1/2), axis_col = grid_col, |
|||
background_col = expanse_cols$background, |
|||
foreground_col = expanse_cols$display_blue, grid = TRUE, |
|||
axis = FALSE, ticks = FALSE) |
|||
} |
|||
\arguments{ |
|||
\item{base_family, base_size}{base font family and size} |
|||
|
|||
\item{plot_title_family, plot_title_face, plot_title_size, plot_title_margin, plot_title_col}{plot tilte family, face, size, margin, and color} |
|||
|
|||
\item{subtitle_family, subtitle_face, subtitle_size, subtitle_col}{plot subtitle family, face, size, and color} |
|||
|
|||
\item{subtitle_margin}{plot subtitle margin bottom (single numeric value)} |
|||
|
|||
\item{strip_text_family, strip_text_face, strip_text_size, strip_text_col}{facet label font family, face and size} |
|||
|
|||
\item{caption_family, caption_face, caption_size, caption_margin, caption_col}{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]}} |
|||
|
|||
\item{plot_margin}{plot margin (specify with \link[ggplot2:margin]{ggplot2::margin})} |
|||
|
|||
\item{panel_spacing}{panel spacing (use \code{unit()})} |
|||
|
|||
\item{text_col, axis_col, background_col, foreground_col}{more colors to set} |
|||
|
|||
\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}{add x or y axes? \code{TRUE}, \code{FALSE}, "\code{xy}"} |
|||
|
|||
\item{ticks}{ticks if \code{TRUE} add ticks} |
|||
} |
|||
\description{ |
|||
You should \url{import_protomolecule} first and also install the fonts on your |
|||
system before trying to use this theme. |
|||
} |
|||
\details{ |
|||
There is an option \code{hrbrthemes.loadfonts} which -- if set to \code{TRUE} -- will |
|||
call \code{extrafont::loadfonts()} to register non-core fonts with R PDF & PostScript |
|||
devices. If you are running under Windows, the package calls the same function |
|||
to register non-core fonts with the Windows graphics device. |
|||
} |
Loading…
Reference in new issue